【发布时间】:2016-12-02 08:34:51
【问题描述】:
这是我的 XML
<resultitem>
<itemname>Restaurant</itemname>
<address>Some Road</address>
<rating>4</rating>
</resultitem>
<resultitem>
<itemname>Cafe</itemname>
<address>Some street</address>
<rating>3</rating>
</resultitem>
我想获得餐厅的评分。我该怎么做?
这是我的 ajax:
$.ajax({
type: 'GET',
url:'someurl',
dataType: 'xml',
success: function(xml){
$(xml).find('resultitem').filter(function(){
var name = $(this).find('itemname').text()==Cafe;
alert(name);
});
}
});
【问题讨论】: