What is the error function of ajax?



  • I have some doubts, what is the error of ajax?

    $.ajax({
                url: 'ws/controller/sys_controller.php?id=4',
                type: 'post',
                data: dados,
                success: function (data) {
                    /*$("#loading").hide();
                    $('#message').html('');
                    $("#message").append(data);
                    $("#message").show( "puff", { times:3, distance:100, direction:'down' }, 2000 ).delay(5000).hide( "puff", { times:3, distance:100, direction:'down' }, 5000 );*/
                    null;
                },
                error: function (request, status, error) {
                    alert(request.responseText);
                }
            });      
    


  • It is possible that if there is a requisition failure with the backend you have an error treatment scope allowing you to provide feedback for the customer interface.

    The function receives three arguments:

    Request that is the propio jqXHR object allowing to make new request ajax or use the internal methods of this object.

    Status can receive the following values besides null, can return with "timeout", "error", "abort", and "parsererror"

    Error that refers to the error message referring to the httpd status that occurred on the server, as "Not found" or " Internal error server

    With this you can establish an algorithmic error treatment (exceptions) provide more detailed information of the problem to the user or administrator.

    You can consult and acquire a more detailed knowledge in the documentation on this page: http://api.jquery.com/jquery.ajax/




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2