0 points

Promise resolution with interval (jquery + iife)


dashboard

Fri Nov 20 2020 06:17:14 GMT+0000 (UTC)

Posted 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_copy Copy