我有一个带有对when服务(ASP.NET)的ajax调用的index.html,当我将它部署到bigrock服务器上(我有一个域)时,它工作得很好。
$.ajax({
type: "POST",
url: "myurl/mywebservice.asmx",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
alert("success");
},
error: function (msg,status) {
$('#demo').html("status is "+status+" . Msg is "+msg.d.responseText);
//attribute for responsetext might be wrong here but in my application it is correct as i am using different system ryt now.
}
});但是当我使用phonegap的在线拉链从html,css,js,web.config中为我的android应用程序创建一个apk,并将它安装在我的device...nothing上时,出现了问题。它显示了一个没有responseText的ajax错误。
我遗漏了什么?
发布于 2012-10-27 14:37:24
当您压缩资产以提交到PhoneGap Build时,您需要包括一个config.xml file并指定类似于
<access origin="https://your.domain.com" />这将指示PhoneGap允许与您的服务器进行通信。
发布于 2012-10-26 17:24:29
当您的应用程序使用PhoneGap部署到设备上时,您的“主页”位置将成为本地设备上的文件系统。
这意味着任何ajax调用都是跨域调用,需要进一步配置才能正确设置。
https://stackoverflow.com/questions/13082829
复制相似问题