PDA

View Full Version : Ajax Request with XML response



Eldavide
17 May 2010, 4:27 AM
Hello there,

I'm searching for about 40 minutes to do an ajax request and then ouput the XML.

The code so far:


// Do an ajax request to delete this user
Ext.Ajax.request({
url: 'url/delete.php',
success: this.deleteSuccess.createDelegate(this, [agentRecord], true),
params: { id: agentRecord.get('id') }

});


The XML


<result> <error>Error to show in alert</error></result>

Now i want to show the error inside the error node in an alert box if the request failes or the <error> node excists. How is this possible?


Kind Regards,
El

Animal
17 May 2010, 4:41 AM
Params to the success hander.

http://www.w3.org/TR/XMLHttpRequest/#the-responsexml-attribute

http://www.extjs.com/deploy/dev/docs/?class=Ext.DomQuery

Eldavide
17 May 2010, 5:50 AM
Thanks!


var errorNode = Ext.DomQuery.selectNode("error", response.responseXML);

How can i get the context of the errorNode ? errorNode.textContent doesn't work in IE..