我将失去我的头发,因为我已经建立了一个简单的应用程序,它在IOS和Android上运行得很好,但是所有的ajax调用都失败了--我尝试了很多mojo jojo技巧,不同版本的cordova,但是没有任何帮助。
我的代码看起来像
$("#twitter").live('pageshow', function() {
// Empty the list of recorded tracks
$("#tweets_list").empty();
var tmpTweet = "";
//regex for urls
var output = $("#tweets_list");
$.ajax({
url: "http://twitter.com/status/user_timeline/mysecretathens.json?count=20&_nocache=" + cacheBuster,
jsonp: 'jsoncallback',
timeout: 5000,
beforeSend: function() {
$('#loader').show();
},
complete: function() {
$('#loader').hide();
},
success: function(data, status) {
$.each(data, function(i, item) {
var tmpTweet = item.text;
//replace links
tmpTweet = item.text.replace(/(http:\/\/\S+)/g, "<a href='$1'>$1</a>");
var singleTweet = "<li class='twitter-feed'>" + item.text + "</li>";
output.append(singleTweet).listview('refresh');
});
},
error: function() {
output.text('There was an error loading the data.');
}
});
$("#tweets_list").listview('refresh');
});我已经将S.support.cors=设置为true;$.mobile.allowCrossDomainPages= true,并尝试了其他一些技巧
唯一起作用的方法是西蒙的 [link],但我想使用我的原始代码,我目前在visual上使用Cordova 2.0.0和windows SDK7.1
发布于 2012-10-01 08:29:13
以下是几个问题:
https://stackoverflow.com/questions/12452257
复制相似问题