Well I have the following Javascript code
function fun() {
$.ajax({
url: 'aposta.php',
success: function(a){
if(a) {
a = JSON.parse(a);
$("#tempo").html(a.time);
if (a.time === 0) {
$('#oi').attr('disabled', 'disabled');
setTimeout(function() {
$('#oi').removeAttr('disabled');
}, 6000);
}
$("#box").animate({
'background-position-x': numero(a.numero)
}, 500);
}
else {
$("#tempo").html("0");
}
}
});
};
setInterval(function(){
fun();
}, 1000);
</script>
What I wanted was in that setinterval that updates every 1 second to put an html code so that this html code is updated without needing refresh if I change the site.
Basically, I want to update this $ balance variable in php every 1 second without having to give f5 on the site.
How can I do this?
Thank you.