[英]Loading another page into DIV and refreshing every 5 seconds
I am using the below to load a form into a div.我正在使用以下内容将表单加载到 div 中。
<script>
$("#TheForm").load("Form.php");
</script>
How can I amend this script to load the content (refresh it) every 5 seconds?如何修改此脚本以每 5 秒加载一次内容(刷新)?
You can use setInterval
, Like this:您可以使用
setInterval
,像这样:
$("#TheForm").load("Form.php"); // For first time
setInterval(() => {
$("#TheForm").load("Form.php");
}, 5000);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.