First write, there are flaws, to be improved
Timer:
Timer timer = new timer ();
Timer.schedule (New TimerTask () {
public void Run () {
Logic code
}
}, 3600000);//an hour
Real-time query:
$ (document). Ready (function () {
Hello ();
});
function Hello () {
$.ajax ({
URL: "Http://xxx.com/a/xx",
Type: "Post",
Data:{sjl:1},
DataType: "JSON",
Success:function (data) {
var str = "";
for (var i = 0; i < data.length; i++) {
str + = "<div class=\" box-body\ ">";
str + = "<ul class=\" Products-list product-list-in-box\ ">";
str + = "<li class=\" item\ ">";
str + = "<div class=\" product-info\ ">";
str + = "<a href=\" javascript:void (0) \ "class=\" product-title\ "></a>";
str + = "<span class=\" product-description\ ">" +data[i]+ "</span>";
str + = "</div>" + "</li>" + "</ul>" + "</div>";
}
$ ("#cid"). html (str);
},
})
}
Pro-Test available!
Java timers and real-time query database