I’m using jquerymobile and wrapping it with phonegap.
I’m using AJAX to retrieve data from server, and it works perfectly on my browser, but when i tried to do it using phonegap application, the ajax call doesn’t seems to work.
In the AJAX call I’m calling to a local php file that retrieve the data from the server with the code line “file_get_contents”.
my phonegap version is 2.0.0, and i also tried to add an access tag in the res\config.xml file with the server url, and i allow internet connection in the application.
Thank you
This is the ajax code I’m using, and when i’m giving the direct url to the server the ajax call fails, and when i give a url to a local php file(not in the server), that retrieve the data from the server, the ajax call success.
$.ajax({
url : url + query,
dataType : ‘html’,
success : function (response) {
$.mobile.loading('hide');
$('body').append(response);
$.mobile.changePage('#page3');
},
error : function () {
alert('loading error') ;
$.mobile.loading('hide');
}
});
Also, when you say a “local php file”, are you referring to one on a local server, or one in the same file directory? PhoneGap will not process PHP files in the directory structure within a PhoneGap application. The PHP file must reside on a web server that can handle PHP.