I have one function checkEvery15Seconds
that runs every 15 seconds. It checks to see if new comments have been added to the page.
I have a form that submits a new comment after clicking the submit button, and then displays the new comment on the page.
In the process of adding a new comment, it checkEvery15Seconds
simultaneously queries the database, so I get duplicate comments on the page (but not in the database, but this is just a problem with JavaScript).
How can I make my submitComment function stop checkEvery15Seconds
and restart it after the submitComment function completes?
source
share