By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,729 Members | 1,343 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,729 IT Pros & Developers. It's quick & easy.

Javascript XMLhttp request help

P: n/a
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 mm******@tpg.com.au or reply to my post.

Thanks Mark..
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a


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).

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

P: n/a
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
"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:41*********************@newsread2.arcor-online.net...


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).

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #3

P: n/a


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.
document.write(xmlhttp.responseText)

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.