简体   繁体   中英

Loading another page into DIV and refreshing every 5 seconds

I am using the below to load a form into a div.

<script>
$("#TheForm").load("Form.php"); 
</script>

How can I amend this script to load the content (refresh it) every 5 seconds?

You can use setInterval , Like this:

$("#TheForm").load("Form.php"); // For first time
setInterval(() => {
  $("#TheForm").load("Form.php");
}, 5000);

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