作者:西红柿 | 来源:互联网 | 2022-12-13 09:51
ImtryingtoextractvaluesfromxmlusingjQueryinacross-browsercompatiblefashion.Imnotha
I'm trying to extract values from xml using jQuery in a cross-browser compatible fashion. I'm not having any issues doing this in firefox, but unfortunately this also has to be IE compatible.
我试图用跨浏览器兼容的方式使用jQuery从xml中提取值。在firefox中我没有遇到任何问题,但不幸的是,这也必须与IE兼容。
My jQuery code looks like this:
我的jQuery代码是这样的:
$(document).ready(function()) {
$.get("file.xml", {}, function(parseRefreshTime){
alert('This line is executed in IE.');
$("created", parseRefreshTime).each(function() {
alert('This line is *not* executed in IE.');
refreshTime = $(this).text();
//do stuff with refreshtime
});
});
});
This extracts the node value for a
node in my xml file.
这将提取xml文件中 <创建的> 节点的节点值。
I'm referencing the jQuery library in my page, and it's parsing properly in Firefox, so I'm assuming that that my parsing code is appropriate. I get both alerts in Firefox, but only the first one in IE.
我在我的页面中引用了jQuery库,它在Firefox中正确解析,所以我假设我的解析代码是合适的。我在Firefox中收到了这两个警告,但只有IE中的第一个。
I could swear I had very similar code working yesterday, but I must have tweaked something and somehow broken it. After fighting with it for almost an hour now, I'm looking for another set of eyes.
我可以发誓昨天我有非常相似的代码,但我一定是修改了一些东西,并以某种方式破坏了它。在与它搏斗了近一个小时之后,我正在寻找另一副眼睛。
Can anyone spot what I'm doing wrong here?
有人能看出我在这里做错了什么吗?
5 个解决方案