The below given code works fine using a wamp server on localhost.It is calling a php file that connects to the MySql DB and returns data.
However i am trying to build a mobileapp using PhoneGap. The below code is in a HTML file. My questions is how will my html file make a connection with the server using ajax once I upload it to phonegap and generate the .apk file. Since the below code just calls the getbustime.php file without any web server parameters.
i have devloped my app in phonegap using HTML,jQueryMobile,Ajax and now willing to upload help ?
function getBusTime(){
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("resultLogBus").innerHTML=xmlhttp.responseText;
// $('#resultLogBus').html(xmlhttp.responseText).selectmenu( "refresh");
}
}
xmlhttp.open("GET","getbustime.php?direction="+direction+"&busnum="+busnum+"&dayofweek="+dayofweek+"&stopname="+stopname+"&starttime="+starttime+"&endtime="+endtime,true);
xmlhttp.send();
}//End of function getBusTime
</script>
http://<YOUR_SERVER_NAME>
orhttp://<YOUR_SERVER_IP>
from your Ajax path. If you are testing it on your local WAMP, remember to open port 80 of your computer firewall and add forwarding rules to your router.