<?php use Illuminate\Support\Facades\Request; return Request::ajax(); /* True | False */
$.ajax({ url: 'http://', type: 'POST', data: {}, tryCount: 0, retryLimit: 3, success: function (response) { //do something }, error: function (xhr, textStatus, errorThrown) { this.tryCount++; if (this.tryCount <= this.retryLimit) { //try again $.ajax(this); return; } if (xhr.status == 500) { //handle error } else { //handle error } } }); |