小弟想要用Asp.net + jquery 实现从数据库的查询问题
public List<two> SelAll()
{
string sql = "select * from two";
return GetListAll(getDS("0", sql));
} public List<two> GetListAll(DataSet ds)
{
List<two> list = new List<two>();
foreach (DataRow dr in ds.Tables[0].Rows)
{
two t = new two();
t.Id = Convert.ToInt32(dr["id"]);
t.Username = dr["username"].ToString();
t.Userpwd = dr["userpwd"].ToString();
t.Age = dr["age"].ToString();
t.Sex = dr["sex"].ToString();
list.Add(t);
}
return list;
}
----------------------------------------------------------DAL层
public List<two> SelAll()
{
return ts.SelAll();
}
----------------------------------------------------------BLL层请问前台页面该如何用Ajax操作,请把具体代码贴出来,小弟初学jquery 跪谢
public List<two> SelAll()
{
string sql = "select * from two";
return GetListAll(getDS("0", sql));
} public List<two> GetListAll(DataSet ds)
{
List<two> list = new List<two>();
foreach (DataRow dr in ds.Tables[0].Rows)
{
two t = new two();
t.Id = Convert.ToInt32(dr["id"]);
t.Username = dr["username"].ToString();
t.Userpwd = dr["userpwd"].ToString();
t.Age = dr["age"].ToString();
t.Sex = dr["sex"].ToString();
list.Add(t);
}
return list;
}
----------------------------------------------------------DAL层
public List<two> SelAll()
{
return ts.SelAll();
}
----------------------------------------------------------BLL层请问前台页面该如何用Ajax操作,请把具体代码贴出来,小弟初学jquery 跪谢
拼接你要的json数据 。当然xml什么的也随便你 。
前台再用$.ajax({})方法解析 。
比如
$.ajax({
type: "post",
url: "tool/GetFirmByBid.ashx",
dataType: "json",
success: function(data){
alert(date);
}
});