Javascript XMLhttp request help

M

Mark

Hi all i was just wondering if you help.

I have to send a cgi request to a company using xmlhttp request. They reply
back with a line of info but when you view the internet explorer source code
you see the XML format.

I was just wonder if anyone could help me save the xml format to a xml file.
I woul like to show you my code but there is to much confidential
information about the company.

Send me an email to (e-mail address removed) or reply to my post.

Thanks Mark..
 
M

Martin Honnen

Mark wrote:

I have to send a cgi request to a company using xmlhttp request. They reply
back with a line of info but when you view the internet explorer source code
you see the XML format.

I was just wonder if anyone could help me save the xml format to a xml file.

If your page is loaded via HTTP in a browser then it usually can't save
file to the local file system, whether you want to use XML or something
else.
You can of course script the response send by the server as
httpRequest.responseXML with DOM methods and send it back to the server
where a CGI script (or PHP or ASP or JSP) can save the XML as needed.

Of course it is als possible to use Microsoft.XMLHTTP with JScript in a
Windows Script Host file or an ASP page and there you can certainly save
to a file using the save method of the DOM document object (e.g.
httpRequest.responseXML).
 
M

Mark

Hi again

The javascript html is running on windows server 2000/windows 2000. I have
the main bit of the code but I have replaced the confidential information
with the word "confidential".

function hit() {
xmlhttp.open("POST", "Confidential ",true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
document.write(xmlhttp.responseText)
}
}
xmlhttp.setRequestHeader("Man", "POST Confidential HTTP/1.1")
xmlhttp.setRequestHeader("MessageType", "CALL")
xmlhttp.setRequestHeader("Content-Type", "text/xml")

xmlhttp.send("<request>confidential</request>")
}


Mark
 
M

Martin Honnen

Mark wrote:

The javascript html is running on windows server 2000/windows 2000.

If the script were run in an ASP page on a server then certainly you
could call
xmlhttp.responseXML.save(Server.MapPath('file.xml'));
but as below you use document.write it appears the script runs inside of
a browser and there you can't save to the local file system with normal
security settings.
If you want to be able to save to the local file system then on Windows
you can use a .hta file instead of .html file, that HTA runs like a
normal application so that script can then access the local file system.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top