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]