delucaspinto

[LARAVEL] SET INTERVAL

Mar 12th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. $(document).ready(function(){
  2.     updateUserActivity();
  3.     console.log('Iniciando atualização periodica');
  4.     setInterval(function(){
  5.         var rel = $("#usuario_id").attr('rel');
  6.         console.log('Módulo iniciado, carregando.');
  7.         $.ajax({
  8.             type: 'post',
  9.             url: '/atualiza-status-logoff',
  10.             data: {
  11.                 get_option: rel
  12.             },
  13.             success: function (response) {
  14.             }
  15.         });
  16.     }, 60000); //300000 é equivalente a 5 minutos -- para teste usamos 3000 que é equivalente a 3 segundos.
  17. });
  18.  
  19. //repetição de código por determinado tempo
Advertisement
Add Comment
Please, Sign In to add comment