Possible Duplicate:
Please explain JSONP
On page 'www.foo.com', can a script loaded from 'www.example.com' send ajax requests to 'www.example.com'?
I need to make a request from a javascript to a php file.
The php file then pulls data from a database, and then sends the information back to the javascript.
I figured the best way to do this would be to make a javascript which uses XMLHTTP to ask the PHP script for the information. Both the Javascript file and PHP file are on the same host.
The catch is that I'm calling the javascript on a different domain. This means I can't set the XMLHTTP.open to a different domain because of the Same-Origin-Policy.
Am I out of luck even though technically both the javascript and php files are on the same host? What is the best way around this? I saw some mentions of using JSON.
The other catch is that I CAN NOT use jQuery. I know things would be easier if I could use jQuery -- but I can't.
This is a pretty close approximation of what I'm trying to do, with the exception being that my request has to be cross-domain:
http://www.w3schools.com/php/php_ajax_database.asp
Any ideas? I'm open to alternative solutions. Thanks!