xmlhttp response -- non xml?

J

Jason Morehouse

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
 
M

Martin Honnen

Jason Morehouse wrote:

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?

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

Jason Morehouse

Martin said:
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.

Ah, that makes sense. Thanks!
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top