我想借此从服务器的一些JSON,但我有错误:Ajax jsonp请求。错误:jQuery的不叫
Error: jQuery111106328444090202681_1494341431062 was not called
at Function.error (file:///C:/Users/adm/Documents/temp/WP/wp/www/jquery/jquery-1.11.1.min.js:2:1809)
at h.jsonp.b.dataTypes.(anonymous function).b.converters.script json (file:///C:/Users/adm/Documents/temp/WP/wp/www/jquery/jquery-1.11.1.min.js:4:27648)
at Pc (file:///C:/Users/adm/Documents/temp/WP/wp/www/jquery/jquery-1.11.1.min.js:4:18120)
at x (file:///C:/Users/adm/Documents/temp/WP/wp/www/jquery/jquery-1.11.1.min.js:4:21525)
at HTMLScriptElement.b.onload.b.onreadystatechange (file:///C:/Users/adm/Documents/temp/WP/wp/www/jquery/jquery-1.11.1.min.js:4:26934)
使用jQuery 1.11.1 jQuery Mobile的 这是我的js代码:
function myRequest() {
$.ajax({
url: "http://dev.agro.ws/result.json",
dataType: 'jsonp',
crossDomain: true,
error: function(xhr, ajaxOptions, thrownError) {
console.log(xhr.status);
console.log(thrownError);
},
success: function(data) {
console.log(data);
}
});
}
$(document).on("pageinit", "#main", function() {
$('#btnDownload').click(function(event) {
myRequest();
});
});
有人可以帮我解决问题吗?在留言中提到
因为您无法使JSON成为JSONP ....您调用的服务器需要支持JSONP。 – epascarello
您的文字图片[不是很有用](// meta.unix.stackexchange.com/q/4086)。它不能被朗读或复制到编辑器中,而且它的索引也不是很好,这意味着具有相同问题的其他用户不太可能在此找到答案。请[编辑]您的文章直接合并相关文本(最好使用复制+粘贴以避免转录错误)。 –