Is It Possible To Prompt User to 'Save' the XMLHttpRequest.xmlResponse() ?

Discussion in 'JavaScript' started by kb4, Jul 20, 2007.

  1. #1
    Hello all,

    I am using XMLHttpRequest to retrieve an XML document which has been created server-side using PHP and returned in responseXML and responseText of the XMLHttpRequest object.

    However I do not wish the browser to display this data as it's an XML file containing Global Positioning Data (eventually to be uploaded onto a GPS device) but instead would like to prompt the user to save it.

    Is it possible to do this once the XML document is available in responseXML or responseText of the XMLHttpRequest object ?

    Many thanks

    Kerry
     
    kb4, Jul 20, 2007 IP
  2. gibex

    gibex Active Member

    Messages:
    1,060
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    95
    #2
    Yes, it's possible.
    you can send that XML data to a php file which do the saving part for you and sending you back a file for download.
     
    gibex, Jul 20, 2007 IP
  3. kb4

    kb4 Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    But how do I do that ? Sorry I should have made it clear in my post that I'm in need of code hints. How do I get to 'prompt' the user to 'Save as' if I am looking at the responseText and/or responseXML ? Or is there some otherway of handling the data once This initial HTTPRequest has been made ?
     
    kb4, Jul 20, 2007 IP
  4. kb4

    kb4 Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Worked the solution out. For my need XMLHTTPRequest is overkill, I just set an url to the location.

    Case solved !
     
    kb4, Jul 20, 2007 IP
  5. gibex

    gibex Active Member

    Messages:
    1,060
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    95
    #5
    Check my sample:

    complete_re method is called when request is finished.
     
    gibex, Jul 21, 2007 IP