if anyone wants to do the same, this will work: <!-- IF S_USER_LOGGED_IN and not S_IS_BOT --> <script> function keepusersonline(){ $.ajax({ url: 'index.php', type: 'post', success: function(data){ // do nothing }, complete:function(data){ setTimeout(fetchdata,240000); } }); } $(document).ready(func...