$.get方法在windowsphone 8 phonegap中不起作用



欢迎大家

我开始使用phonegap对windows phone 8进行编程,但问题是$.get方法在尝试时不起作用我的应用程序在windows手机模拟器

但当在浏览器中尝试成功时

那么我该如何解决这个问题。

这是我的代码:

$.get('li.tmpl', function (response) { elementsTmpl = _.template(response);
$.each(titles, function (index, data) { alert(data); addItem(data); }); 

我已经在Windows Phone Phonegap应用程序中成功地使用$.get读取模板。这是我的建议:

您可以使用以下方法来跟踪读取元素时出现问题的罪魁祸首:

$.get(your_element).success(function(template, status, response) {
    console.log(response.responseText);
}).error(function(error) {
    console.log("error "+ error.status +": "+ error.statusText);
});

如果$.get失败,那么您将收到错误消息,并开始检测其中的错误。

最新更新