Hi I've created an App which uses Ajax request to grab some data from a table stored within my database, and loop it out through some html. Its working perfectly on my localhost however, when downloading it to my android phone, it appears something is not happening?
Do i need to update my config file to allow Access-Control-Allow-Origin: *' if yes, how is this written??
Do i need to update my config file to allow Access-Control-Allow-Origin: *' if yes, how is this written??
- 7 Posts
- 0 Reply Likes
- frustrated
Posted 4 years ago
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
Do i need to update my config file to allow Access-Control-Allow-Origin: *'No.
when downloading it to my android phone, it appears something is not happeningWhen downloading...what? The app assets? The data? Anything else?
- 7 Posts
- 0 Reply Likes
Sorry, that was poorly wrote. Yes when downloading the app onto my android phone, it appears its not making the ajax request to the server. When starting the app, it comes up with a small message saying "Loading abbreviations..." and then a few seconds later, the contents is loaded. This works on localhost however, on my phone its stuck on the first screen? 

- 7 Posts
- 0 Reply Likes
$.ajax({
url: 'http://ppl-support.co.uk/ratchetserve...', // URL -> load the data
crossDomain: true,
success: function(data){
$(".list").html(data);
}
});
$(function(){ // Search functionality
$(".search").keyup(function()
{
var searchid = $(this).val();
var dataString = 'search='+ searchid;
if(searchid!='')
{
$.ajax({
type: "POST",
url: "http://ppl-support.co.uk/ratchetserve...",
data: dataString,
cache: false,
crossDomain: true,
success: function(html) {
$(".list").html(html).show();
}
});
}else{
$.ajax({
url: 'http://ppl-support.co.uk/ratchetserve...', //load data
success: function(data){
$(".list").html(data);
}
});
}
return true;
});
});
Is my ajax code.
url: 'http://ppl-support.co.uk/ratchetserve...', // URL -> load the data
crossDomain: true,
success: function(data){
$(".list").html(data);
}
});
$(function(){ // Search functionality
$(".search").keyup(function()
{
var searchid = $(this).val();
var dataString = 'search='+ searchid;
if(searchid!='')
{
$.ajax({
type: "POST",
url: "http://ppl-support.co.uk/ratchetserve...",
data: dataString,
cache: false,
crossDomain: true,
success: function(html) {
$(".list").html(html).show();
}
});
}else{
$.ajax({
url: 'http://ppl-support.co.uk/ratchetserve...', //load data
success: function(data){
$(".list").html(data);
}
});
}
return true;
});
});
Is my ajax code.
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
Most likely, your whitelisting is not sufficient.
How did you whitelist ppl-support.co.uk ?
[Note: don't worry about 'crossdomain'. There is no such thing when making ajax calls from the app.]
If you aren't sure, then make your zip file available somewhere and post its url. I'll be happy to have a look.
How did you whitelist ppl-support.co.uk ?
[Note: don't worry about 'crossdomain'. There is no such thing when making ajax calls from the app.]
If you aren't sure, then make your zip file available somewhere and post its url. I'll be happy to have a look.
- 7 Posts
- 0 Reply Likes
Thanks petra, I haven't checked this - the URL i've used is http://ppl-support.co.uk/ratchetserve... - please email me @ mike.rodwell@ppl-support.co.uk - I'll send you my file?
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
Sorry, I don't communicate by e-mail. This is a forum and if we took this in private, noone else could benefit from this thread.
Alternatively, if you don't wish to make your zip file public, you could:
- post your config here
- confirm that both config.xml and index.html are in the root directory of your zip file.
Alternatively, if you don't wish to make your zip file public, you could:
- post your config here
- confirm that both config.xml and index.html are in the root directory of your zip file.
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
Your code doesn't show, probably because you failed to read and apply the forum information under "some HTML allowed". See the CODE element.
- 7 Posts
- 0 Reply Likes
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
Erm...is that your full config in the left pane?
- 7 Posts
- 0 Reply Likes
Indeed, I'm very new to App building and using Phonegap. (still a learning process).
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
OK. You may want to read the PGB Docs (see link in main bar of this forum).
Especially the Configuration, Plugins, Icons and Splashscreens and the Whitelisting section.
Especially the Configuration, Plugins, Icons and Splashscreens and the Whitelisting section.
Related Categories
-
PhoneGap Build
- 15111 Conversations
- 275 Followers


