为了说明我的问题,下面的一些代码片段
这是我的Ajax调用:
$.ajaxSetup({
headers: {
"X-Requested-With" : "XMLHttpRequest",
"Content-Type" : "application/atom+xml",
"cache-control" : "no-cache",
"DataServiceVersion" : "2.0",
"X-CSRF-Token" : header_xcsrf_token,
},
cache: false,
});
$.ajax({
type: 'POST',
url: url + new Date().getTime(),
data : data,
beforeSend : function(xhr) {
// crypto call before authentication
var bytes = Crypto.charenc.Binary.stringToBytes(user + ":" + password);
var base64 = Crypto.util.bytesToBase64(bytes);
//build request header
xhr.setRequestHeader("Authorization", "Basic " + base64);
},
success: function(data, status, xhr) {
alert("data sent");
},
error: function(jqXHR, textStatus, errorThrown){
alert(textStatus + " " + errorThrown + " " + jqXHR.status + " " + jqXHR.responseText);
}
});
中的src /文件夹中的Java代码
:
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.init();
super.appView.getSettings().setAppCacheEnabled(false);
super.loadUrl(Config.getStartUrl());
CookieManager.getInstance().setAcceptCookie(true);
// Set by <content src="index.html" /> in config.xml
//super.loadUrl("file:///android_asset/www/index.html");
}
每次阿贾克斯发布采购信息它被引导到缓存,并且我不知道如何防止它。这是我从请求得到响应时调试我的科尔多瓦与应用程序开发工具:
http://pl.vc/59s6o
这听起来像您的浏览器或服务器,而不是JQuery的一个问题。 – css
我开发这个项目作为一个Web应用程序和Cordova项目。 Web应用程序可以正常使用我在Cordova项目中使用的相同请求。我用铬和邮差测试过它。该问题仅在科尔多瓦项目 – user3589902