Reputation: 354
I have a index.html with an ajax call to a webservice(ASP.NET) that works fine when i deploy it on the bigrock server(i have a domain).
$.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.
}
});
But when i used the online zipper of phonegap to make a apk for my android app from the html, css,js,web.config,few class and installed it on my device...nothing comes up. Its shows me an ajax error with no responseText.
What am i missing?
Upvotes: 2
Views: 1606
Reputation:
When you zip up your assets to submit to PhoneGap Build, you need to include a config.xml file and specify access policy similar to
<access origin="https://your.domain.com" />
This will instruct PhoneGap to allow communication with your server.
Upvotes: 1
Reputation: 1656
When your app is deployed to the device using PhoneGap, your "Home" location becomes the file-system on the local device.
This means any ajax calls are cross-domain calls which require further configuration to setup correctly.
See this question for potential answer
Upvotes: 0