My webservice generates jsonp response same as http://demos.kendoui.com/service/products.
When i try to create datasource for my webservice i am getting callback is not defined error in firebug console.
Webservice response.
callback([{“category”:null,”productName”:”Puma”,”productId”:1,”quantity”:0,”price”:3000.0,”categoryId”:1,”description”:”ok”}])
But when i use kendo ui webservice (http://demos.kendoui.com/service/Products) i am getting a valid datasource.
Code :
$(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())
});
});
please suggest.
I guess the function name is not
callbackcallback is just the key and the function itself maybe called sth like
jQuery17101014779508113Can you look at what your datasource is sending to the server during the read operation? (Chrome / Firebug Network Tab)
I’m taking the $_REQUEST[‘callback’] variable (with a PHP-Script) and just returning it as the padding. Since you’re just using a static .json file and the callback function name will be changed on each request (to prevent caching), you won’t ever have the correct function name.
So: I suggest you use JSON instead of P or you dynamically return the same callback you’re receiving.
Cheers….