AJAX发送错误

I have a strange problem with jQuery ajax function in my script.

my problem only happen on my friend computer but i don't suffer from any thing on my computer.

I tried to make error function property alert error contents but something strange happened

$.ajax({
    url : EXECUTION_URL + 'ajax/users.php',
    type : 'POST',
    error : function( err1, err2, err3 ) {
        alert(err2 + ' : ' + err3 + ' , ' + err1.responseText);
    },
    data : {
        'value' : 'val',
        'type' : 'email'
    },
    success : function( data, statusText, xhr ) {
        alert(data)
    },
});

the important line is :
alert(err2 + ' : ' + err3 + ' , '+ err1.responseText)
but it fire only : 'error: , ' .
why this happen ? and how i can know the error of sending this request

Probably, the objects you're trying to alert can't be converted to string (for the alert text). Try using a console.log. Then you'll know what's happening and you'll be able to fix the problem.

Your error function

error : function( err1, err2, err3 ) {  // is equivalent to 

error : function(jqXHR, textStatus, errorThrown)  

Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". 

Maybe the err2 is null and that's the reason you see no output for err2

Try using the $.ajaxSetup() to get the correct error like this:

$(function() {
    $.ajaxSetup({
        error: function(jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connect.
 Verify Network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Internal Server Error [500].');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Uncaught Error.
' + jqXHR.responseText);
            }
        }
    });
});

Remove the error function in your ajax call and then call your ajax method. In case, there's some error, the ajax setup would catch it and display a proper alert based on the error that occurred.