jQuery的阿贾克斯$(XML).find()的作品,但在IE浏览器不 [英] jQuery ajax $(xml).find() works in IE but not Chrome
问题描述
我想提出一个FetchXML要求CRM从托管在同一个CRM实例webresource
I am making a FetchXML request to CRM from a webresource hosted on the same CRM instance
这code工作在IE浏览器,但没有在Chrome浏览器,为什么?
This code works in IE but doesn't in Chrome...Why?
$.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。
The problem isn't with the ajax call the problem is with the .find() not getting the node from the returned xml.
所以要清楚,我得到什么看起来像在同一个XML回程从每个浏览器的请求,但这里find方法
So to be clear I get what looks like the same xml back from the request in each browser but the find method here
$(data).find('a\\Entity')
返回镀铬中没有物品......它完美的IE浏览器。
returns no items in chrome...it works perfectly in IE.
推荐答案
OK,我想我已经找到了问题
OK, I think I have found the problem
http://bugs.jquery.com/ticket/155
jQuery的发现()有因的selectSingleNode在不同浏览器的不同实现的问题。
jQuery find() has problems because of different implementations of selectSingleNode in different browsers.
这个错误说,它的固定的,但我不认为它是。
This bug says its fixed but I don't think it is.
修改
我发现,做选择的样子,这似乎工作
I found that making the selector look like this seems to work
$(xml).find("a\\:Entity, Entity")
这是一个黑客位,但它解决了我的具体问题
It's a bit of a hack but it solves my particular problem
这篇关于jQuery的阿贾克斯$(XML).find()的作品,但在IE浏览器不的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!