Reputation: 23
This is a piece of code that I am working on, however there are some issues that I do not understand:
handleGeocoderResponse: function(response, ajaxOptions, comboBoxIdentifier) {
var self = this;
var xml = response.responseXML ;
// step 1: error process explicit error message, then exit out of here if we encounter an error
var errorNode = Ext.DomQuery.selectNode("error", xml);
if (errorNode) {
console.log("GEOCODE ERROR: " + errorNode.firstChild.nodeValue);
this.form.setErrorMessage(comboBoxIdentifier);
return;
}
the function handleGeocoderResponse
represents the success function in an
ext.ajax.request, what I don't understand is the var xml. What is responseXML and what exactly should return it? and what about (Ext.DomQuery.selectNode) and what its supposed to do ?
Upvotes: 1
Views: 3551
Reputation: 19560
The .responseXML
property of the response
object given to an XMLHttpRequest
's success
method is a Document
object representing the XML which was returned from the server after it has been parsed (if parseable XML was returned).
.selectNode
is a method of Ext
's DomQuery
module which allows you to ask for DOM elements from a given Document or DOM node. In this case, it is asking for the error
node of the Document returned from the server during the request.
XMLHttpRequest
responseXML
docs:
DomQuery
selectNode
docs:
Upvotes: 3