I am trying to access the elements within the xml response object, but I'm getting Uncaught Error: SYNTAX_ERR: DOM Exception 12
我试图访问xml响应对象中的元素,但我得到未捕获错误:SYNTAX_ERR:DOM异常12
Here's the xml:
这是xml:
<ASIInventory request="01/28/2013 08:01" excute="366">
<Inventory SKU="102040">
<ItemId>920-002478</ItemId>
<Description>
<![CDATA[
Logitech Keyboard 920-002478 Desktop K120 USB Black Retail
]]>
</Description>
<Vendor>Logitech</Vendor>
<Category>KB</Category>
<SubCategory>98</SubCategory>
<UPC>097855065537</UPC>
<Price>11.00</Price>
<Rebate>
<![CDATA[ none ]]>
</Rebate>
<Term>none</Term>
<Weight>1.63</Weight>
<Status>ACTIVE</Status>
<Qty>
<Branch Code="1016" Name="Fremont">44</Branch>
<Branch Code="1028" Name="Los Angeles">121</Branch>
<Branch Code="1116" Name="Atlanta">47</Branch>
<Branch Code="1216" Name="Chicago">37</Branch>
<Branch Code="1316" Name="Dallas">23</Branch>
<Branch Code="1516" Name="Kansas">0</Branch>
<Branch Code="1716" Name="New Jersey">3</Branch>
<Branch Code="2416" Name="Miami">0</Branch>
<Branch Code="2616" Name="Portland">0</Branch>
</Qty>
</Inventory>
</ASIInventory>
Here is my browser script code:
这是我的浏览器脚本代码:
$(document).ready(function(){
$.ajax({
url: 'some.xml',
dataType: "xml",
success: function(xml) {
var test = $(xml).find('Vendor').text();
alert(test);
}
});
});
});
1 个解决方案
#1
0
Is it me, or you have an extra '}); ' at the end of your script? Other than that it seems ok to me, or at which line does the console says you got an error?
是我,还是你有额外的'}); '在你的脚本结束?除此之外,对我来说似乎没问题,或者控制台说你出错了?
#1
0
Is it me, or you have an extra '}); ' at the end of your script? Other than that it seems ok to me, or at which line does the console says you got an error?
是我,还是你有额外的'}); '在你的脚本结束?除此之外,对我来说似乎没问题,或者控制台说你出错了?