ajax请求中的responseXML是什么?

时间:2022-10-13 13:47:41

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 ?

handleGeocoderResponse函数表示ext.ajax中的成功函数。请求,我不理解的是var xml。什么是responseXML,应该返回什么?那么(Ext.DomQuery.selectNode)呢?它应该做什么?

1 个解决方案

#1


3  

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).

给XMLHttpRequest的成功方法的响应对象的. responsexml属性是表示解析后从服务器返回的XML(如果解析XML被返回)的文档对象。

.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.

. selectnode是Ext的DomQuery模块的一种方法,允许您从给定的文档或DOM节点中查询DOM元素。在本例中,它请求在请求期间从服务器返回的文档的错误节点。

#1


3  

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).

给XMLHttpRequest的成功方法的响应对象的. responsexml属性是表示解析后从服务器返回的XML(如果解析XML被返回)的文档对象。

.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.

. selectnode是Ext的DomQuery模块的一种方法,允许您从给定的文档或DOM节点中查询DOM元素。在本例中,它请求在请求期间从服务器返回的文档的错误节点。