0

I've some ajax calls in which I would like to add handler in case of an error. I found the "error" handler but that doesn't work i.e. when internet connection is lost. Is there a second handler for these cases?

$.ajax({
      type: "GET",
      url: "dosomethink.php",
      success: function (data) {
        $('#abc').html(data);
      },
      error: function (xhr, ajaxOptions, thrownError) {
        alert(xhr.status);
        alert(thrownError);
      }
    });
Thomas1703
  • 1,152
  • 5
  • 16
  • 33

1 Answers1

0

what if you using timeout and the error method

$.ajax({type: 'GET',url: '/controller/action',timeout: 15000,success: function(data) {},error: function(XMLHttpRequest, textStatus,errorThrown) {}});
Alireza Masali
  • 668
  • 1
  • 10
  • 19