my question is how can i show instant some information before load setInterval in jquery, and when is load setInterval will update it.
<script type=\"text/javascript\">
function getData(){
$(\"#whereshow\").load(\"somefile.php\");
}
setInterval(\"getData()\", 5000);
</script>
Can i make something like that?
<script type=\"text/javascript\">
function getData1(){
$(\"#whereshow\").load(\"somefile.php\");
}
function getData(){
$(\"#whereshow\").load(\"somefile.php\");
}
setInterval(\"getData()\", 5000);
</script>
…and getData1() will display instant onload page info, then will stop, and setIntervall wil do the other update job?
Basically what you want to do is have the
setIntervalfire immediately as well as on the interval.That’s easy.
See, just call the function 😉 I also added some improvements to your script.
EDIT: Another way of doing it that I just thought of: