我的网络服务生成与http: //demos.kendoui.com/service/products 相同的 jsonp 响应。
当我尝试为我的 web 服务创建数据源时,我在 firebug 控制台中收到回调未定义错误。
网络服务响应。
callback([{"category":null,"productName":"Puma","productId":1,"quantity":0,"price":3000.0,"categoryId":1,"description":"ok"} ])
但是当我使用 kendo ui webservice (http://demos.kendoui.com/service/Products) 时,我得到了一个有效的数据源。
代码 :
$(document).ready(function() {
var dataSource = new kendo.data.DataSource({
transport: {
read: {
//url: "http://demos.kendoui.com/service/products",
url: "http://localhost:8080/mobile-services/rest/categories/1/products.json",
dataType: "jsonp"
}
},
pageSize: 12
});
$("#pager").kendoPager({
dataSource: dataSource
});
$("#listView").kendoListView({
dataSource: dataSource,
template: kendo.template($("#template").html())
});
});
请建议。