简体   繁体   中英

Reset javascript page refresh value after jquery ajax action

If certain conditions are met I use a jquery ajax query to display a message on a page. When I click close on the message it disappears. I also have some javascript on the same page that automatically refreshes the page after 30 seconds. What I'm trying to do is when I click close on the message it resets the automatic refresh back to 30 seconds.

tried this?

mytimeout = setTimeout("alert('refreshing page')", 30000);

And then on button click do:

clearTimeout(mytimeout);
mytimeout = setTimeout("alert('refreshing page')", 30000);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM