jQuery   发布时间:2022-04-19  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Jquery Ajax在Internet Explorer中不起作用大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
当我在Internet Explorer 9上使用jQuery ajax时,我在响应主体处获取数据但是它没有传递给成功函数.我怎样才能使它工作?

例:

...
    $.ajax({
        async : false,type: 'PUT',contentType: 'application/json',url: updateUrl,data: JSON.stringify(model),dataType: 'json',success: function(data) {
            console.log("Here!");//it comes here
            console.log(data);//it logs undefine at ie,firefox and etc is logging data
            r = resultResponse(data);
        },error: function(data) {
            try {
                r = error($.parseJSON(data.responseText));
            } catch (err) {
                //Handle error
            }
        }
    });
...

我调试了网络,看到响应正文是:

{"message":"Connection is successful","status":"success"}

但是,Internet Explorer的成功功能未定义数据.

有任何想法吗?

PS 1:奇怪的是,当我从服务器发送数据而没有设置响应头的内容类型时,它有效吗?

PS 2:我的回复标题如下:

Key Value
Response    HTTP/1.1 200 OK
Server  Apache-Coyote/1.1
Content-Type    application/json;charset=UTF8
transfer-encoding   chunked
Date    Thu,02 Aug 2012 15:50:44 GMT

解决方法

输出中可以看出,我的字符集是UTF8而不是UTF-8.问题是在服务器端.

大佬总结

以上是大佬教程为你收集整理的Jquery Ajax在Internet Explorer中不起作用全部内容,希望文章能够帮你解决Jquery Ajax在Internet Explorer中不起作用所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: