我正在尝试将jTable与数据绑定,但我的web方法没有返回任何内容。我可以从Chrome开发者控制台看到这一点。这是代码:
[WebMethod(EnableSession = true)]
public static object ProductList()
{
try
{
List<Product> products = new List<Product>();
products.Add(new Product { ProductId = 1, ProductName = "Mercedes", Category = "Cars", Price = 20 });
products.Add(new Product { ProductId = 1, ProductName = "Mercedes", Category = "Cars", Price = 20 });
products.Add(new Product { ProductId = 1, ProductName = "Mercedes", Category = "Cars", Price = 20 });
return new { Result = "OK", Records = products };
}
catch (Exception ex)
{
return new { Result = "ERROR", Message = ex.Message };
}
}
答案 0 :(得分:0)
解决了它。必须在必须显示jtable的html文件中引用特定文件。如下所示:
<script src="Scripts/jtable/extensions/jquery.jtable.aspnetpagemethods.min.js"></script>