jQuery AJAX调用在Firefox中有效,但在IE中无效-返回有效响应 [英] jQuery AJAX call works in Firefox but not IE - valid response returned
本文介绍了jQuery AJAX调用在Firefox中有效,但在IE中无效-返回有效响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在AJAX调用中遇到了一个奇怪的问题,该问题在Firefox中起作用,但在IE中却不起作用.当我添加IE alert()时,我看到返回的内容,但是它不希望使用jQuery .html()命令插入.这是我的示例代码:
I am having a strange issue with an AJAX call where it is working in Firefox, but not in IE. When I add an IE alert(), I see the returned content, but it does not want ot insert with the jQuery .html() command. Here is my sample code:
$(document).on('click','.OpenForm',function(e) {
e.preventDefault();
var FormControl = $(this).attr('id'); //ex: id=FormView_12 or FormEdit_12
FormControl = FormControl.split('_');
var FormControlType = FormControl[0];
var FormID = FormControl[1];
$.post("./includes/Getform.php", { "t" : "view" , FormID : FormID })
.done(function(data) {
if (data.length>0){
data = data.replace(/(\r\n|\n|\r)/gm,"");
//alert(data); ---THIS ALERTS THE RESPONSE IN IE8
//console.log(data); --- THIS SHOWS RESPONSE IN FF
$('.ProjectContentLoad').html(data).show();
}
})
.fail( function(xhr, textStatus, errorThrown) {
error_handling(xhr.responseText);
});
});
推荐答案
也许您返回的HTML无效. FF没问题,但是IE8确实有问题;)也许您忘记了关闭div?
Perhaps your returned HTML is invalid. FF doesn't have problems with that, but IE8 sure does ;) Maybe you forget to close a div?
The following post shows some guys having the exact same problem: jQuery AJAX GET html data IE8 not working
这篇关于jQuery AJAX调用在Firefox中有效,但在IE中无效-返回有效响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文