【发布时间】:2013-10-30 11:12:25
【问题描述】:
这个错误快把我逼疯了。
在使用 jquery 2.0.3 时它可以工作,当我更改为 jQuery 1.10.2 时它不会! 我需要使用 jQuery 1.10 才能使用 jquery 移动面板小部件 不知道怎么回事,json是合法的js我测试一下。
这是代码:(我更改了 html 以获取警报)
$(document).on('pageinit', "#news_list", function () {
$.ajax({
type: "GET",
crossDomain: true,
url: "http://app.virtual-competiciones.es/api/news/getnews?num=20",
headers: { "Accept-Encoding": "gzip" },
dataType: 'json',
cache: false,
success: function (data) {
var result = data;
alert("ok");
},
error: function (xhr, status, error) {
alert("ERROR - xhr.status: " + xhr.status + '\nxhr.responseText: ' + xhr.responseText + '\nxhr.statusText: ' + xhr.statusText + '\nError: ' + error + '\nStatus: ' + status);
}
});
return false;
});
我得到的错误是未定义的(无传输)
【问题讨论】:
-
“这个错误快把我逼疯了” - 一定是你忘记告诉我们什么错误的原因……
-
你用的是哪个jqm版本?
-
我告诉你,它不起作用。错误在底部。
标签: jquery ajax json jquery-mobile