Jquery IE8:在AJAX响应中,在响应html中查找标记不起作用,但适用于其他浏览器
我有如下ajax调用Jquery IE8:在AJAX响应中,在响应html中查找标记不起作用,但适用于其他浏览器,jquery,ajax,Jquery,Ajax,我有如下ajax调用 $.ajax({type: "GET", url: url, cache: false, dataType: "html", beforeSend: function() { // some before code here } success: function(resp) { resp_html = $(resp).find('.somedivclass').html(); //doesnt
$.ajax({type: "GET",
url: url,
cache: false,
dataType: "html",
beforeSend: function() {
// some before code here
}
success: function(resp) {
resp_html = $(resp).find('.somedivclass').html(); //doesnt work for IE8
alert(resp_html);
}
});
当我对resp_html发出警报时,对于其他浏览器它会工作。
但对于IE8来说,它不是吗?为什么?以下两个调用中的任何一个都不适用于IE8
resp_html = $(resp).find('.somedivclass').html(); //doesnt work for IE8
或
请看,您在控制台中看到的错误是什么?你看到Freez的链接了吗?看一看Freez的链接,他们有一个解决办法,检查一下http响应的内容类型。如果是
application/xhtml+xml
或者您的页面中有xhtml DTD,则可能是这一问题的原因。类似于DOCTYPE HTML…
@drt尝试使用W3C验证程序验证您的HTML响应,并检查是否存在错误
resp_html = $('.somedivclass', resp).html(); //doesnt work for IE8