首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JQuery $.ajax IE8

JQuery $.ajax IE8
EN

Stack Overflow用户
提问于 2014-06-02 22:03:11
回答 1查看 63关注 0票数 0

我在获取xhr对象的responseText属性时遇到了问题。当我试图直接访问xhr变量时,我得到了一个对象对象;

代码语言:javascript
复制
$.ajax({
            'url': that.data('url'),
            'async': false,
            'type': 'get',
            'beforeSend': function() {
                onBeforeSend(that);
            },
            'success': function(res, req, xhr) {
                alert(xhr);
                alert(xhr.responseText);
                if ((typeof res == 'undefined') && (typeof xhr == 'undefined')) {
                    res = (function() {
                        try {
                            return new (this.XMLHttpRequest||ActiveXObject)('MSXML2.XMLHTTP.3.0');
                        } catch (e) {
                            alert('Exception');
                        }
                    });
                }
                container.html(res.responseText);
            },
            'error': function(res, xhr) {
                container.html(res.responseText);
            },
            'complete': function() {
                onComplete(that);
            }
        });

此故障在安装了XP操作系统的IE-8中显示。有谁能帮帮我,求求你。

EN

回答 1

Stack Overflow用户

发布于 2014-06-02 22:56:28

尝试将dataType属性添加到选项中,它可以是html、JSON、xml或文本

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23996449

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档