我正在尝试将 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 };
}
}