xnpeng
03-23-2006, 03:44 AM
http://www.dynamicdrive.com/dynamici...jaxroutine.htm
What's the difference between responseText and responseXML?
when I get response from a jsp file, alert(ajax.responseText) ,it shows:
<?xml version="1.0" encoding="utf-8"?>
<employees>
<employee name="J.Doe">
<job>Programmer</job>
<salary>32768</salary>
</employee>
<employee name="A.Baker">
<job>Sales</job>
<salary>70000</salary>
</employee>
<employee name="Big Cheese">
<job>CEO</job>
<salary>100000</salary>
</employee>
</employees>
while use alert(ajax.responseXML), it shows [object].
the point is that I need retrieve certain data in this XML, that is how to handle xmlObj = ajax.responseXML?
xmlObj.getELementsByTagName("employee")[0].firstChild.data does not work.
I found Microsoft.XMLDOM object can load (not open) an xml file into an xmlObj,which can be handle like xmlObj.getELementsByTagName("employee")[0].firstChild.data .
So what is the difference between XMLDOM and XMLHTTP?
What's the difference between responseText and responseXML?
when I get response from a jsp file, alert(ajax.responseText) ,it shows:
<?xml version="1.0" encoding="utf-8"?>
<employees>
<employee name="J.Doe">
<job>Programmer</job>
<salary>32768</salary>
</employee>
<employee name="A.Baker">
<job>Sales</job>
<salary>70000</salary>
</employee>
<employee name="Big Cheese">
<job>CEO</job>
<salary>100000</salary>
</employee>
</employees>
while use alert(ajax.responseXML), it shows [object].
the point is that I need retrieve certain data in this XML, that is how to handle xmlObj = ajax.responseXML?
xmlObj.getELementsByTagName("employee")[0].firstChild.data does not work.
I found Microsoft.XMLDOM object can load (not open) an xml file into an xmlObj,which can be handle like xmlObj.getELementsByTagName("employee")[0].firstChild.data .
So what is the difference between XMLDOM and XMLHTTP?