Javascript XMLhttp request help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark

    #1

    Javascript XMLhttp request help

    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 mmcveigh@tpg.co m.au or reply to my post.

    Thanks Mark..


  • Martin Honnen

    #2
    Re: Javascript XMLhttp request help



    Mark wrote:

    [color=blue]
    > 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.[/color]

    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.res ponseXML 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.XMLHT TP 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.res ponseXML).

    --

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

    Comment

    • Mark

      #3
      Re: Javascript XMLhttp request help

      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 "confidenti al".

      function hit() {
      xmlhttp.open("P OST", "Confidenti al ",true);
      xmlhttp.onready statechange=fun ction() {
      if (xmlhttp.readyS tate==4) {
      document.write( xmlhttp.respons eText)
      }
      }
      xmlhttp.setRequ estHeader("Man" , "POST Confidential HTTP/1.1")
      xmlhttp.setRequ estHeader("Mess ageType", "CALL")
      xmlhttp.setRequ estHeader("Cont ent-Type", "text/xml")

      xmlhttp.send("< request>confide ntial</request>")
      }


      Mark


      "Martin Honnen" <mahotrash@yaho o.de> wrote in message
      news:41f8e696$0 $806$9b4e6d93@n ewsread2.arcor-online.net...[color=blue]
      >
      >
      > Mark wrote:
      >
      >[color=green]
      >> 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.[/color]
      >
      > 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.res ponseXML 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.XMLHT TP 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.res ponseXML).
      >
      > --
      >
      > Martin Honnen
      > http://JavaScript.FAQTs.com/[/color]


      Comment

      • Martin Honnen

        #4
        Re: Javascript XMLhttp request help



        Mark wrote:

        [color=blue]
        > The javascript html is running on windows server 2000/windows 2000.[/color]

        If the script were run in an ASP page on a server then certainly you
        could call
        xmlhttp.respons eXML.save(Serve r.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.
        [color=blue]
        > document.write( xmlhttp.respons eText)[/color]


        --

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

        Comment

        Working...