Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript &引用;xml查找";这不是一个函数_Javascript_Jquery_Ajax_Xml - Fatal编程技术网

Javascript &引用;xml查找";这不是一个函数

Javascript &引用;xml查找";这不是一个函数,javascript,jquery,ajax,xml,Javascript,Jquery,Ajax,Xml,我目前有以下ajax调用,该调用已成功运行: $.ajax({ url: "services/orders/<%=OrderServices.Action.BULK_SUPPLIER_DISCOUNT%>", data: params, complete: function(xhr) { if (ajax.fullCheck(xhr, "delete your selected i

我目前有以下ajax调用,该调用已成功运行:

$.ajax({
            url: "services/orders/<%=OrderServices.Action.BULK_SUPPLIER_DISCOUNT%>",
            data: params,
            complete: function(xhr) {
                if (ajax.fullCheck(xhr, "delete your selected item")) {
                    unsavedChanges = false;
                }
                var xml = xhr.responseXML;
            updateAutoTotalsFromXml(xml);

            }
        });
想法?

根据:

将字符串解析为XML文档

parseXML使用浏览器的本机解析功能创建有效的XML文档。然后,可以将此文档传递给jQuery,以创建一个可以遍历和操作的典型jQuery对象

只有在可以使用find函数后,才能将xml转换为jqueryObject:

var xml='0070.490024.87';
函数updateAutoTotalsFromXml(xml){
log(xml);
var xmlDoc=$.parseXML(xml);
var jqObj=$(xmlDoc);
curFixedCost=parseFloat(jqObj.find(“FixedCost”).text());
curFixedPrice=parseFloat(jqObj.find(“FixedPrice”).text());
curVarCost=parseFloat(jqObj.find(“VarCost”).text());
curVarPrice=parseFloat(jqObj.find(“VarPrice”).text());
log('curFixedCost:'+curFixedCost+
“curFixedPrice:”+curFixedPrice+
“curVarCost:”+curVarCost+
“曲线清晰度:”+曲线清晰度)
}
updateAutoTotalsFromXml(xml);
根据:

将字符串解析为XML文档

parseXML使用浏览器的本机解析功能创建有效的XML文档。然后,可以将此文档传递给jQuery,以创建一个可以遍历和操作的典型jQuery对象

只有在可以使用find函数后,才能将xml转换为jqueryObject:

var xml='0070.490024.87';
函数updateAutoTotalsFromXml(xml){
log(xml);
var xmlDoc=$.parseXML(xml);
var jqObj=$(xmlDoc);
curFixedCost=parseFloat(jqObj.find(“FixedCost”).text());
curFixedPrice=parseFloat(jqObj.find(“FixedPrice”).text());
curVarCost=parseFloat(jqObj.find(“VarCost”).text());
curVarPrice=parseFloat(jqObj.find(“VarPrice”).text());
log('curFixedCost:'+curFixedCost+
“curFixedPrice:”+curFixedPrice+
“curVarCost:”+curVarCost+
“曲线清晰度:”+曲线清晰度)
}
updateAutoTotalsFromXml(xml);

你认为
.find()
会是什么?错误告诉您没有这样的函数..find()是一个jquery函数,它应该查找FixedPrice等的文本。您认为
.find()
是什么?错误是告诉您没有这样的函数..find()是一个jquery函数,它应该查找FixedPrice等的文本。
<Response><Totals><FixedCost>0</FixedCost><FixedPrice>0</FixedPrice><VarCost>70.4900</VarCost><VarPrice>224.87</VarPrice></Totals><Success/></Response>
function updateAutoTotalsFromXml(xml) {
        console.log(xml);
        curFixedCost = parseFloat(xml.find("FixedCost").text());
        curFixedPrice = parseFloat(xml.find("FixedPrice").text());
        curVarCost = parseFloat(xml.find("VarCost").text());
        curVarPrice = parseFloat(xml.find("VarPrice").text());
    }