我试图让从我的PhoneGap应用程序一个Ajax请求的servlet在我的笔记本电脑上运行, 它击中服务器,但AJAX请求总是会出错的一部分。 如果我会做普通的浏览器工作正常了同样的要求。
i am trying to make an ajax request from my phonegap app to servlet running on my laptop, its hitting server but the ajax request is always going to error part. If i will do the same request in normal browser working fine.
function cred() {
var username = "hisari";
var password = "kumar";
var ul = "ip" ;
$.ajax({
type: "GET",
url: ul,
dataType: "json",
success: function(msg, textstatus) {
alert("success");
if (msg.id != null)
{
} else if (msg.error_id)
{
//Error
alert('Error logging in:' + msg.error_message);
}
},
error: function(error) {
alert("Error connecting to the servers" + error.message);
}
});
}
请给我一个解决方案,如果可能的话建议我可以用Servelet的是什么,而不是进行登录验证
please give me a solution ,If possible suggest what can i use instead of servelet for login validation
你有没有加入你的主机config.xml中的白名单?
Have you added your host to whitelist in config.xml?
<获得原产地=HTTP://127.0.0.1*/>
<获得原产地=HTTP://*.google.com/>
<access origin="http://127.0.0.1*" />
<access origin="http://*.google.com" />