Promise resolution with interval (jquery + iife)

PHOTO EMBED

Fri Nov 20 2020 06:17:14 GMT+0000 (Coordinated Universal Time)

Saved by @eneki

(function refreshPendingIncidents() {
  $.ajax({
    url: '/pending-incidents/refresh/' + "{{ $reports[0]->id }}",
    success: function(data) {
      console.log(data)
      console.log('test')
    },
    complete: function() {
      // Schedule the next request when the current one's complete
      setTimeout(refreshPendingIncidents, 3000);
    }
  });
})();
content_copyCOPY