Java脚本/ jquery以定期时间间隔调用服务器端函数。 [英] Java script/jquery to call a serverside function on regular time intervals.

查看:73
本文介绍了Java脚本/ jquery以定期时间间隔调用服务器端函数。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个要求,数据存储在sql database中。我需要根据网页上存储的数据和当前系统时间使用javascript警告用户。我需要执行基于sql数据库数据和jquery中的当前时间进行计算,然后提醒用户如outlook remaining.Please help。

Hi,
I have a requirement that has data stored in sql database.I need to alert the user based on data stored sql and current system time on the webpage using javascript .I need to perform calculations based on sql database data and current time in jquery and then alert user like outlook remainder.Please help.

推荐答案

你可以使用setTimeout()函数。 />


函数runQuery(){
You can use the setTimeout() function.

function runQuery() {


.ajax({

url:'url /path/here.php',

成功:功能(数据){

//在这里做你想做的事情

}

});

setTimeout(runQuery,5000);

}



//现在在文档加载时启动
.ajax({
url: 'url/path/here.php',
success: function(data) {
// do what you want here
}
});
setTimeout(runQuery, 5000);
}

//Now make it start when the document loads


(document).ready(function(){

setTimeout(runQuery,5000);

});



我希望这会起作用。
(document).ready(function() {
setTimeout(runQuery, 5000);
});

I hope this will work.


这篇关于Java脚本/ jquery以定期时间间隔调用服务器端函数。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆