gpt4 book ai didi

jQuery ajax $(xml).find() 适用于 IE 但不适用于 Chrome

转载 作者:数据小太阳 更新时间:2023-10-29 02:54:00 25 4
gpt4 key购买 nike

我正在从同一 CRM 实例上托管的 Web 资源向 CRM 发出 FetchXML 请求

此代码在 IE 中有效,但在 Chrome 中无效...为什么?

    $.ajax({
type: "POST",
dataType: 'xml',
contentType: "text/xml; charset=utf-8",
processData: false,
url: path,
data: fetchRequest,
beforeSend: function(xhr) {
xhr.setRequestHeader(
"SOAPAction",
"http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute"
); //without the SOAPAction header, CRM will return a 500 error
}
}).done(
function(data){
$(data).find("a\\:Entity").each(function () {
// loop entered in IE but not in chrome
}
}
);

编辑

问题不在于 ajax 调用,问题在于 .find() 没有从返回的 xml 中获取节点。

所以要明确一点,我从每个浏览器的请求中得到了看起来相同的 xml,但这里是 find 方法

$(data).find('a\\Entity') 

在 chrome 中不返回任何项目...它在 IE 中完美运行。

最佳答案

好的,我想我找到问题了

http://bugs.jquery.com/ticket/155

由于 selectSingleNode 在不同浏览器中的不同实现,jQuery find() 存在问题。

这个错误说它已修复,但我不认为它是。

编辑

我发现让选择器看起来像这样似乎可行

$(xml).find("a\\:Entity, Entity")

这有点hack,但它解决了我的特殊问题

关于jQuery ajax $(xml).find() 适用于 IE 但不适用于 Chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15776529/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com