最後,我有一個Ajax請求到數據庫服務器和返回數據類型是xml但IE無法呈現它。但在鉻它的作品。什麼可能是錯誤的,我的codeActually我沒有得到響應的服務器。我在xml文檔中使用的元素名稱是,,,而不是更多。所以我真的不知道問題在哪裏。
$.ajax({
url:'gethint.php',
type:'GET',
data:'p=p' + '&cust_uid=i',
datatype:'xml',
timeout:5000,
error:function(){alert('unable to establish connection to the server ');},
success:function(xml){outputResponseXML(xml);}
});
function outputResponseXML(xml)
{
$('div#me').empty();
var element =$(xml).find('USER');
if(element.length>0)
{
$(xml).find('USER').each(
function(index)
{
var ename= ($(this).find('ENAME').text()=='E')?'':$(this).find('ENAME').text();
var operator=($(this).find('OPERATOR').text()=='E')?'':$(this).find('OPERATOR').text();
var pnr =($(this).find('PNR').text()=='E')?'':$(this).find('PNR').text();
var inr=($(this).find('INR').text()=='E')?'':$(this).find('INR').text();
var $newDiv= $('<div class=\"items\" id =\"'+inr +'\">'
+ename+'<br/>'+operator+
'<br/>'+ pnr+'</div>');
$newDiv.appendTo('div#me');
});
}
else
{
$('div.me').html('no suggestions found');
}
}
你可以發佈回覆嗎? IE不喜歡XML中實際HTML元素的元素名稱。 – 2010-06-25 12:03:05
檢查您的接受率! – Thariama 2010-06-25 12:04:24
我發現你有一天有類似的問題。 http://stackoverflow.com/questions/3081071/convert-a-string-to-xml-doc-with-jquery-or-the-other-way-round **亞倫**的答案有幫助嗎?它應該工作。您正在使用的IE中禁用了「加載項」?它顯然在一些裝置中發生。 – user113716 2010-06-25 12:44:36