Question

I am trying to call a php file which is located on a webserver(1freehosting.com) from ajax code which is present in an html file located on my localhost machine (wamp). I tried all diffrent iteration given below but non seems to be working.

xmlhttp.open("GET","bcbustransit.uni.me/getdirection.php?q="+str.value,true);
xmlhttp.open("GET","http://bcbustransit.uni.me/getdirection.php?q="+str.value,true);
xmlhttp.open("GET","http://www.bcbustransit.uni.me/getdirection.php?q="+str.value,true);

When i upload the same html file on the same webserver(1freehosting.com) and then make a call it works as specified below.

xmlhttp.open("GET","getdirection.php?q="+str.value,true); 

How can i make a call to a php file on a webserver from my localhost machine ? Is there something i am doing wrong

No correct solution

OTHER TIPS

Check this question Same Origin Policy - AJAX & using Public APIs It should be the same problem and has a solution for your problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top