Why is the IE8 error in $ .post () ["The object does not support this property or method"]?

I searched high and low, but I can’t say that it is even mentioned. Using jQuery 1.4.4 (and no other library), this only happens so far in Internet Explorer 8 . Error: "The object does not support this property or method", and the line it points to is below $.post(.

Js

HTML is exceptional, so I will just post JS.

$(window).load(function(){

$("input[type='submit']", ".scope").live("click", function(e){
    e.preventDefault();
    // some intervening code defining variables used below...

    //only var which is at all complex
    var inputs = $form.find(":input").serializeArray();

    $.post(
        action,
        inputs,
        function(data){
            var $json = $.parseJSON(data);
            if ( $json.success == true ) {
                if ( testVar == 2 ) {
                    if ( $json.tabkill == true ) {
                        killTab(tabID);
                    } else {
                        loadPane(rID,tabID,"refreshTop");
                    }
                } else {
                    loadPane(rID,tabID);
                }
            } else {
                //modal dialogue error message, excised
            }
        }
    ).ajaxError(function(e, xhr, settings, exception) {
        if (settings.url == action) {
            alert("Problem calling: "+settings.url+"\n code: "+xhr.status+"\n exception: "+exception);
        }
    });

    return false;
});

//end window load block
});
+3
source share
3 answers

The problem is your line ajaxError.

, $.post XMLHTTPRequest, jQuery. ajaxError jQuery.

:

1) jQuery 1.5. XMLHTTPRequest jqXHR. error , :

$.post(
    action,
    inputs,
    function(data){
        /* ... */
    }
).error(function(){
    alert ("Problem calling: " + action + "\nCode: " + this.status + "\nException: " + this.statusText);
});

2) $.ajax error:

$.ajax({
    url: action,
    data: inputs,
    success: function(data){
        /* ... */
    },
    error: function(xhr, textStatus, error) {
        alert("Problem calling: " + action + "\nCode: " + xhr.status + "\nException: " + textStatus);
    }
});
+5

, ajaxError() (docs) jQuery, $.post() (docs) XMLHttpRequest .

, .

+5

, :

).ajaxError(function(e, xhr, settings, exception) {
        if (settings.url == action) {
            alert("Problem calling: "+settings.url+"\n code: "+xhr.status+"\n exception: "+exception);
        }
    });

jQuery.

EDIT : what Patrick said.

+2
source

Source: https://habr.com/ru/post/1790785/


All Articles