I’ m using this code in my mobile application built with phonegap and jQuery I want to show pictures from server but I couldn’t integrate showPageLoadingMsg function and I ‘m not convinced that this type of Ajax call is useful and powerful. So I want really know what type of Ajax call I should use and how to use showPageLoadingMsg() function in my Android phone application .
server = "http://monserveur.com/upload.php";
var wid = $(window).width();
if (server) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState == 4){
alert('ready');
if (xmlhttp.status == 200 ) {
alert('200');
document.getElementById('ousa').innerHTML = xmlhttp.responseText;
}
else {
document.getElementById('ousa').innerHTML = "Error retrieving pictures from server.";
}
}
};
xmlhttp.open("GET", server+"?wid="+wid, true);
xmlhttp.send();
Have you tried
http://api.jquery.com/ajaxStart/
http://api.jquery.com/ajaxStop/
and couple them with a logic like found here
http://www.w3schools.com/jquery/ajax_ajaxstart.asp
This will basically add a listener if added to a self executing function or the dom ready logic of your script this listener will wait for anything ajax related to run.
also I notice you mention phonegap, are you currently using the xhr.js they suggest using with AJAX requests? If not its something I suggest looking into, due to the same domain policy your AJAX may just be failing silently and very quickly. the xhr.js over comes the bounds of the same domain policy.