刷新脚本而不重新加载整个页面


大家好,我有一个div脚本,例如每30分钟更改一次我可以在不重新加载整个页面的情况下从数据服务器刷新这个Div脚本吗(客户端(这是html脚本
<script type="text/javascript">
var today = new Date();
<script >

Div Xpath是

/html/head/script[9]/text()

看到这个答案了吗:AJAX间隔刷新?

当您使用间隔每隔x秒检索一次数据时,您可以选择DIV并在其中插入新数据。

(function update() {
$.ajax({
//Retrieve the new data here
}).then(function() {           // on completion, restart after 30 seconds
//Insert new data here
//Example: $('.classname').html(data);
setTimeout(update, 30000);  // function refers to itself
});
})();

最新更新