[英]JQuery Ajax calls not working in Phonegap after building it
当我在node.js中使用phonegap serve
运行项目时,AJAX可以正常工作。 但是,当我创建一个apk文件来测试它在分发时是否可以正常工作时,它将无法正常工作。 我已经添加了csp和白名单,但仍然无法正常工作。
这是我的AJAX电话:
$(".credits").click(function(){
$.ajax({
type: "POST",
url: serviceURL+"check_user.php",
data: "devID="+device.uuid,
success: function(html){
if (html == 'true') {
$(".loading_status").text("Account Registered");
$(".index_button").fadeIn("fast");
} else {
$(".loading_status").text("Account Not Registered");
//this closes the app.
//navigator.app.exitApp();
}
},
error: function(jq, status, message){
alert("ERROR 100: CONNECTION ERROR!");
}
});
//REQUESTING FOR AJAX FUNCTION
/*$(document).ajaxSend(function(e, xhr, opt){
//$(".index_button").fadeOut("fast");
$(".credits").fadeIn("fast");
$(".loading_status").text("Loading...");
});*/
});
我已经在config.xml中添加了它
<allow-navigation href="*" />
<allow-intent href="*" />
<access origin="*" />
任何人? 提前致谢。 :)
尝试将此元标记添加到您应用的html文件中:
<meta http-equiv="Content-Security-Policy" content="*">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.