jHeartbeat是一个jQuery的插件,用来定时执行某项任务,例如定时向服务器发送请求;定时更新页面元素等等,特别适合用在聊天室开发上。
使用方法:
<scripttype=”text/javascript”src=”js/jquery.js”></script><scripttype=”text/javascript”src=js/jheartbeat.js”></script><scripttype=”text/javascript”> $(document).ready(function(){ $.jheartbeat.set({ url:“data.php”,//TheURLthatjHeartbeatwillretrieve delay:1500,//HowoftenjHeartbeatshouldretrievetheURL div_id:“test_div”//Wherethedatawillbeappended. ,function(){ //CallbackFunction }); }); });</script>
评论