ajax局部刷新

//5秒刷新一次

$(function () {
setInterval(Refresh, 5000);
});

 

//ajax局部刷新

function Refresh() {
$.ajax({
type: "POST",
url: "/User/GetInfo",
dataType: "json",
data: {},
success: function (data) {
$("#mytable tr:gt(0)").remove();
var info = "";
$.each(data, function (i, v) {
info += "<tr>";
info += "<td>" + v.Name+ "</td>";
info += "<td>" + v.BAK + "</td>";
info += "<td>" + ChangeDateFormat(v.CreateTime) + "</td>";//json日期格式转换
info += "</tr>";
});
$("#mytable").append($(info));
},
async: true
});
}

posted @ 2016-12-26 15:29  Zbu  阅读(162)  评论(0编辑  收藏  举报