调用 jsonp 响应但收到错误:未调用 jQuery18207158344800118357_1359997121430。有人可以让我知道如何解决这个问题吗?感谢你的帮助。以下是客户端代码:
var dataSource = new kendo.data.DataSource({
serverPaging: true,
pageSize: 2,
type: "odata",
error: function(e) {
console.log("Error " + e);
alert(e.errorThrown);
},
transport: {
read: {
url: "http://localhost:50675/movie/GetAll", // the remove service url
dataType: "jsonp"
},
parameterMap: function(options) {
alert("Inside parameterMap")
alert(JSON.stringify(options, null, 4));
return {
q: "javascript",
page: options.page,
rpp: options.pageSize,
};
}
},
schema: {
errors: function(response) {
return response.errors;
},
data: function(data) {
if (data.movieList.length == 0) {
return [];
}
return data.movieList;
},
total: function(data) {
alert(data.movieList.length);
return data.movieList.length;
}
}
});
$("#localListView").kendoMobileListView({
dataSource: dataSource,
pullToRefresh: true,
appendOnRefresh: true,
template: $("#categories-template").html(),
pullParameters: function(item) {
alert("Inside pullParameters")
alert(item.length);
alert(JSON.stringify(item, null, 4));
return {
page: 1
};
}
});
在 Chrome 开发人员工具中检查时,成功接收到来自服务器的响应。以下是来自服务器的 jsonp 响应:
({"movieList":[{"ID":1,"Title":"Movie","ReleaseDate":"/Date(487189800000)/","Genre":"Comedy","Price":30}, {"ID":1,"Title":"Movie","ReleaseDate":"/Date(487189800000)/","Genre":"Comedy","Price":30}],"count":4} )