0
您好我有一個Web方法,將數據庫的數據並將其傳遞給jQuery的ajax函數,但我不知道它可能傳遞ArrayList到jQuery和jQuery能夠識別它或否,如果回答是好的我如何使用jquery ajax中的數組列表。 了我的身後使用arraylist傳遞給jquery ajax
[WebMethod]
public ArrayList bringdata()
{
SqlConnection con = new SqlConnection("data source=.;database=site;integrated security=true;");
int cnt;
string sSQL = "Select username ,average,weight,point , Rank() over(order by point desc) as 'ranking' from karbar order by point desc";
SqlCommand cmd = new SqlCommand(sSQL, con);
SqlDataAdapter adapt = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
adapt.Fill(ds);
ArrayList arrlst = new ArrayList();
foreach (DataRow row in ds.Tables[0].Rows)
{
arrlst.Add(row);
}
return arrlst;
}
代碼,請幫我在jQuery代碼使用數組列表。 感謝很多
我不知道C#和asp.net,但我想你可以輸出ArrayList爲JSON,並解析它在客戶端 – ThoKra 2012-08-05 07:24:27
你是對的,但任何解決方案存在使用jQuery中arraylist? – quantum62 2012-08-05 08:12:37
你有JavaScript或Arrays,可能是C#ArrayLists的代表 – ThoKra 2012-08-05 08:13:48