【发布时间】:2010-09-13 14:19:49
【问题描述】:
我正在使用 jQuery.ajax 从文件中解析一些 xml。在 IE (6,7,8)、Firefox、Opera 和 Safari 中一切正常,但在 Google Chrome 中失败。代码如下:
/* ... */
this.loadXml = function()
{
$.ajax(
{
type: "GET",
url: "some_file.xml",
dataType: ($.browser.msie) ? "text" : "xml",
success: function(xml)
{
if($.browser.msie)
{
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.loadXML(xml);
xml = xmlDoc;
}
/* parsing starts here */
/* for example: in the document I have a div tag with id "some text" and the xml file contains: <root><tag>test</tag></root>*/
$("#some_id").text($(xml).find("root > tag").text());
/* parsing ends here */
}
});
}
【问题讨论】:
标签: jquery xml google-chrome