PDA

View Full Version : Extracting HTML from ajax response [object XMLDocument]



glafrance
29 Apr 2013, 4:44 PM
I have an ajax call and when I try to use the response (which is HTML) it is [object XMLDocument].

The ajax call gets HTML that has no root tag, I just need to render it, but how to extract the HTML in useable form?

slemmon
1 May 2013, 1:42 PM
Here's the example from the Ext.Ajax.request() method:



Ext.Ajax.request({
url: 'ajax_demo/sample.json',
success: function(response, opts) {
var obj = Ext.decode(response.responseText);
console.dir(obj);
},
failure: function(response, opts) {
console.log('server-side failure with status code ' + response.status);
}
});


In the success handler two params are passed and the first can be decoded to give you access to the response string from your server (under responseText).