473,408 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

responseXML vs. responseText

1
First of all, I am very much a newbie...

From what I have read, it seems to me that both of these should be filled in all the time. The responseXML being a DOM representation and the responseText being a string representation of the response. Right? If so, then why do I sometimes have a responseText with no responseXML?

A second part to that question is accessing the data in responseText. Here is what I have done. On the server side, I have this statement
[PHP]<cotd chefs="<?=serialize($randchefs)?>" /cotd>[/PHP]

$randchefs is an array of 10 items each with 3 fields. As I understand XML, I cannot pass that as an array so I serialized it. Now in my javascript, I want to unserialize it. Here's my code...
[PHP]$randchefs=unserialize(req.responseText);[/PHP]

I am using the responseText field because the data is not in the responseXML field. The above line of code does not seem to work and I do not understand why. I suspect I am missing some basic concept but after hours of googling, I still can't figure it out. Can someone help me?

If it helps, here is the larger block of javascript

[PHP]function getRandomChefs() {
new Ajax.Request('/admin/services/rest/editorial/otd/chef/randchefs',
{
method: 'post',
parameters: Form.serialize('addform'),
onComplete: function(req) {
$randchefs=unserialize(req.responseText);
console.log($randchefs);

}
}
);

}[/PHP]
Dec 13 '06 #1
1 4262
steven
143 100+
From what I have read, it seems to me that both of these should be filled in all the time. The responseXML being a DOM representation and the responseText being a string representation of the response. Right? If so, then why do I sometimes have a responseText with no responseXML?
To my understanding, responseXML will only contain content when your server script responds with XML.

I believe you would need to set the header content type as text/xml

in your script. Then it should send any response with that content type.

Perhaps this tutorial can help you.

http://www-128.ibm.com/developerworks/web/library/wa-ajaxintro8.html
Dec 14 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Sanjay Dahiya | last post by:
I tried POSTing from XMLHttpRequest, i can get the XML right on server but responseXML from server is coming null. I can see the XML right in responseText. but responseXML is null. responseText to...
3
by: joker | last post by:
Thanks in Advance. I'm trying to find out why my responseXML is empty when the Content-Type for my request is "text/xml". I'm calling into a servlet from a web page on the same domain returning...
2
by: ErkA | last post by:
Hello sorry of omy pure english ;) I think, that something wrong is in mozilla *FF 1,5,0,2* I'm trying to parse a xml file http://bazarek.pl/txt/note.xml by XMLHttpRequest method. In IE,...
1
by: MD | last post by:
Following snippet is the portion of my program to get the location list in xml with AJAX when i alert(request.responseText) it manages to display the xml document like the following <? xml...
14
by: webEater | last post by:
I downloaded IE7 and tried out the native XMLHttpRequest support. I think there is an object in IE7 called "XMLHttpRequest" but I ask me why it is called "XML"HttpRequest. I made a request to an...
1
by: Pugi! | last post by:
Currently I am using a responsexml for an xmlhttprequest. The information is then processed by javascript : elements are created with attributes incl events using setAttribute; in other words I...
1
by: vunet.us | last post by:
My XML HTTP Request sends results in responseText. The result is an XML file I will need to parse. After research I determined that a cross browser XML parser will look like this: ...
1
by: Sand Yaah | last post by:
i went thru a discussion put by eros and helped out by dmjpros. d questions asked were right and i tried each but there was no problem there. my code returns null in xmlHttp.responseXML and...
4
by: crc294 | last post by:
Hi all, in order to experiment with AJAX, I created a site called Rob's Easy Budget Tool (http://budget.edgerob.net). Check it out if ya like. I found its functionality useful so I made it available...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.