以下在 Chrome 和 Firefox 中运行良好,但在 IE 中不起作用。它在 IE 中获取数据(我可以在控制台中看到它) - 但它也没有循环.each
:
function searchServing(which,choice){
var url = "search.asp?" + which + "=" + choice;
$.get(url, function(data){
console.log("data" + data);
$.each($(data).find("company"),function(index, el) {
loc = $(this).find('Location').text();
console.log("loc: "+ loc);
});
})//$.get(url, function(data){
.error(function() {
})//.error(function() {
.success(function(data) {
$.each($('company',data),function(index, el) {
loc = $(this).find('Location').text();
console.log("location: "+ loc);
}
}
}
XML 采用这种格式:
<company>
<sql><%=sSQL%></sql>
<uid><%=uid%></uid>
<companyName><%=company%></companyName>
<location><%=location%></location>
<phone1><%=phone1%></phone1>
<phone2><%=phone2%></phone2>
<phone3><%=tollfree%></phone3>
<serving><%=serving%></serving>
</company>