2011-08-18 48 views
0

我在jsfiddle中有下面的例子,它在Firefox 6和Chrome中完美工作,但在IE8中沒有。我該如何解決這個問題?xml解析IE瀏覽器問題中的jquery

var xml = "<Response> <isSuccess>true</isSuccess> <operation>viewall</operation> <message>No configurations were found for this project</message></Response>"; 

alert($(xml).find('message').text()); 

回答

0

你需要使用.parseXML

var xml = "<Response> <isSuccess>true</isSuccess> <operation>viewall</operation> <message>No configurations were found for this project</message></Response>"; 

    xmlDoc = $.parseXML(xml), 
    $xml = $(xmlDoc), 
    $title = $xml.find("message").text(); 

alert($title); 

這裏是小提琴http://jsfiddle.net/szVKD/1/

jquery parse xml