View Full Version : XMLHttpRequest

10-31-2006, 03:57 PM
Hello everyone there,

I have a small question. I am trying to make a request but ti do not have permision from server yet (I will). The question is, can I test it locally. I have an example of the response xml (SOAP). Is it possible to do that?

Thank you for your help.

10-31-2006, 04:33 PM
The XHR object is restricted to the same domain policy. Hope you are taking this into account with this web service.

How can you test locally. Save the soap message as an XML document and call it.


10-31-2006, 05:41 PM
I have had the same problem where I needed to use Ajax to display a page that relied on information coming from another server.

As it has been stated above, due to security restrictions, XMLHttpRequests must be made to the same server. But there is a hack to this, it is not the best in the world....but should solve your problem.

To do this, you need to create a page on your server that will read contents from the source that might be located on the internet. Here is an example.

$url = $_GET['url' ];
$var = file_get_contents ("http://www.example.com/", "r");
echo $var;

That is, than you can you have your XMLHttpRequest object calling that file on your server and you should be set to go..

All the best.

11-02-2006, 10:17 AM
Thank you for your answers,

yes I know thar there are some restrictions and i will get an interface from the server, but till that I have to fake it and try the next steps. So I would like to test it locally.

A1ien51 how can I call the xml file? with xmlhttprequest as well? I remind you that the response.xml is a SOAP file. I do not want to use php, just simple javaScript.

Thank you for your help

11-02-2006, 01:51 PM
You save the file on your local server/computer as an XML document and you link to it in the open() method.


11-03-2006, 12:45 PM
Thank you, but I cannot do it. It is supposed to be easy but anyway I always get failures.

Can you give me a small code? Then I could get on working.

Thank you