I need to refresh a div on 3 sec so I tried a setInterval method as follows using javaScript:
<button onclick="myFunction()">Try it</button>
<script>
function hello(){
alert("vannallo");
}
function myFunction() {
setInterval(hello(), 3000);
}
</script>
This is not working, But when I tried like thje following it works:
function myFunction() {
setInterval(function hello(){
alert("vannallo");
}, 3000);
}
I need to work setInterval continuosly on my first buttonclick , How can I acheive it? Please help guys!!