xmlhttp response -- non xml?

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

    #1

    xmlhttp response -- non xml?

    Hello,

    Just playing around with xmlhttp at the moment. I was just wondering if
    there is any reason (browser compatibility etc) the response data has to
    be formatted in xml, or can I send csv or whatever else if the handler
    is up for it?

    Cheers
    -J

    --
    Jason Morehouse
    Vendorama - Create your own online store
    http://www.vendorama.com
  • Martin Honnen

    #2
    Re: xmlhttp response -- non xml?



    Jason Morehouse wrote:

    [color=blue]
    > Just playing around with xmlhttp at the moment. I was just wondering if
    > there is any reason (browser compatibility etc) the response data has to
    > be formatted in xml, or can I send csv or whatever else if the handler
    > is up for it?[/color]

    There is both a responseText and a responseXML property so if you don't
    want to use XML you can receive other text as needed but need to be
    aware that responseText doesn't pay attention to encodings so you should
    send the text as UTF-8 from the server if you need characters in
    responseText that are outside of ASCII. And of course with
    sending/receicing XML you get it parsed and can access it in responseXML
    using the DOM while for csv you need to write your own parsing routine
    first.

    --

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

    Comment

    • Jason Morehouse

      #3
      Re: xmlhttp response -- non xml?

      Martin Honnen wrote:[color=blue]
      > There is both a responseText and a responseXML property so if you don't
      > want to use XML you can receive other text as needed but need to be
      > aware that responseText doesn't pay attention to encodings so you should
      > send the text as UTF-8 from the server if you need characters in
      > responseText that are outside of ASCII. And of course with
      > sending/receicing XML you get it parsed and can access it in responseXML
      > using the DOM while for csv you need to write your own parsing routine
      > first.
      >[/color]

      Ah, that makes sense. Thanks!


      --
      Jason Morehouse
      Vendorama - Create your own online store
      http://www.vendorama.com

      Comment

      Working...