User have to see all bets in their dashboard so I created a a function every 2secs that loads all players bet 1 and players bet 2. I want to bind the function to a button so it will STOP running continuously when betting is close and waiting for the outcome and START the function again when the betting is open.
Here's my code:
$(document).ready(function(){
$("#load_bets1").load("loadbet1.php");
setInterval(function() {
$("#load_bets1").load("loadbet1.php");
}, 2000);
});
$(document).ready(function(){
$("#load_bets2").load("loadbet2.php");
setInterval(function() {
$("#load_bets2").load("loadbet2.php");
}, 2000);
});