Reputation: 1189
Below code works correct on server, but not locally. I don't use localhost, i just open html file in firefox. I need to make it works like that because this is for phone app (phonegap) and it wont be upload to any server.
jQuery library is loaded correclty.
$.ajax({
type: "GET",
url: "http://www.mydomain.co.uk/test-login.php",
data: { curPage: 153 }
}).done(function( msg ) {
$('body').html( msg );
});
Upvotes: 0
Views: 713
Reputation: 651
For security reasons, AJAX will not work when used on different domains. Like from site1.com to site2.com. So when you tried to access your online website via localhost, you will see an error in your web inspector. To make it work on phonegap, you will have to whitelist the website in your config.xml
http://docs.phonegap.com/en/1.9.0/guide_whitelist_index.md.html
Upvotes: 1