在 IE8 中的 ajax 请求给出此错误后:由于错误80020101,无法完成操作

After ajax request in IE8 give this error: Could not complete the operation due to error 80020101

本文关键字:错误 80020101 操作 于错误 请求 ajax 中的 IE8      更新时间:2023-09-26

我在js中有一个函数,在chrome中工作正常,但不能在IE中工作

<script type="text/javascript">
        function save () {
                                $.ajax({
                                url: 'somepage.aspx',
                                data: {
                                    cmd: "add",
                                    },
                                type: 'POST',
                                async: true,
                                cache: false,
                                success: function (data, textStatus, xhr) {
                                // somelogic
                                }
                            });
                        }
 </script>

Chrome中工作正常,但是在IE中给出此错误:

SCRIPT257:由于错误80020101,无法完成操作。

jquery-1.7.1.min.js,第 2 行字符 11497

提前致谢

我忘了删除数据中有几个变量data:{ cmd:"add", itemId: $("#someInputId").val(),otherId: $("#someInputId2").val()}编辑:

<script type="text/javascript">
        function save () {
                                $.ajax({
                                url: 'somepage.aspx',
                                data: {
                                    cmd:"add", 
                                    itemId: $("#someInputId").val(),
                                    anotherId: $("#someInputId2").val()
                                    },
                                type: 'POST',
                                async: true,
                                cache: false,
                                success: function (data, textStatus, xhr) {
                                // somelogic
                               }
                            });
                        }
 </script>

删除数据对象中"add"后面的逗号。 IE在很多时候不喜欢这样。

看起来也有一些语法错误......成功处理程序中的额外大括号。

试试这个:

function save() {
    $.ajax({
        url: 'somepage.aspx',
        data: {
            cmd: "add"
        },
        type: 'POST',
        async: true,
        cache: false,
        success: function (data, textStatus, xhr) {
            // some logic
        }
    });
}