Alex
Alex

Reputation: 9720

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

I have one function in js, in chrome work ok,. but not working in 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>

in Chrome work ok, but in ie give this error:

SCRIPT257: Could not complete the operation due to error 80020101.

jquery-1.7.1.min.js, line 2 character 11497

thanks in advance

I forgot to delete , I had several variables in data data:{ cmd:"add", itemId: $("#someInputId").val(),anotherId: $("#someInputId2").val()} Edited:

<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>

Upvotes: 0

Views: 630

Answers (1)

Mingle
Mingle

Reputation: 836

Remove the comma after "add" in the data object. IE doesn't like this a lot of the times.

It also looks like there is some syntax errors.. the extra brace in the success handler for one.

Try this:

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

Upvotes: 1

Related Questions