0
我正在开发一个WCF应用程序,并且前端使用JSON来调用Web方法。WCF和Json致电
我有一个数据模型类,如下如下
[DataContract]
public class GL_AccMainTypeListItem
{
[DataMember]
public int accMainTypeyNo { get; set; }
[DataMember]
public string mainType { get; set; }
[DataMember]
public int startAccNo { get; set; }
[DataMember]
public int endAccNo { get; set; }
}
我的Web方法,并返回上述对象列表。基本上在这里我用存储过程(这些工作得很好)
[OperationContract]
[WebInvoke(Method = "GET", UriTemplate = "GetDataString/{value}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
public List<GL_AccMainTypeListItem> GL_AccMainType_GetAll()
{
DataAccessService da = new DataAccessService("usp_GL_AccMainTypeGetAll");
DataTable dt = da.ExecuteDataTable();
var acc = (from row in dt.AsEnumerable()
select new GL_AccMainTypeListItem
{
accMainTypeyNo = Utility.ToInt(row["accMainTypeNo"]),
mainType = Utility.ToString(row["mainType"]),
startAccNo = Utility.ToInt(row["startAccNo"]),
endAccNo = Utility.ToInt(row["endAccNo"])
});
return acc.ToList();
}
,并从数据库中获取的数据表,并返回到客户端。我想知道如何使用JQuery在客户端调用此Web服务,并逐行迭代结果集。