[英]Jquery .find() doesn't return data…in IE
Jquery Source : jQuery来源:
$.ajax({
type: 'get'
, dataType: 'text'
, url: 'navigation.html'
, cache: false
, success: function(data, status){
var xml;
if ($.browser.msie) {
xml = new ActiveXObject("Microsoft.XMLDOM");
xml.async = false;
xml.loadXML(data);
} else {
xml = data;
}
$(xml).find('menu').each(function(){
if($(this).attr('level') =="0"){
............
here navigation.html 这里navigation.html
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<navigation id="GNBContainer">
<menu level="0" nodeId="STS2" parentId="0">
<name>
Home
</name>
<a href="../index.htm"></a>
</menu>
.find() doesn't return data in IE but does in FF and chrome navigation.html, this file extension can not be changed. .find()不会在IE中返回数据,但在FF和chrome navigation.html中会返回数据,此文件扩展名无法更改。
navigation.html Content-Type : text/html also can't be changed.... navigation.html Content-Type:文本/ html也无法更改。
help me..... 帮我.....
You can't maybe use a workaround, just add an id
to your element : 您可能无法使用解决方法,只需将
id
添加到您的元素中:
<menu id="mymenu" level="0" nodeId="STS2" parentId="0">
Then you can do : 然后,您可以执行以下操作:
$(xml).find('#mymenu').each(function() {
If you can't modify the file, you can eventually do : 如果您无法修改文件,则可以最终进行:
$(xml).find('#GNBContainer').children().each(function() {
But you'll maybe have to adapt this to better comply with your HTML structure. 但是您可能必须对此进行调整以更好地符合HTML结构。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.