$(function () {
$("#btnDelete").click(function () {
var v;
var $check = $("#tableUserInfo :checkbox:checked");
$check.each(function () {
v = $(this).parents("tr").find("td").eq(1).text().trim();
});
$.ajax({
type: "post",
url: "/Handlers/UserInfo.ashx",
data: {
method: "DeleteUserInfo",
UserID:v
},
dataType: "json",
success: function (data) {
$.each(data, function (index, o) {
var s = "";
s += "<tr>";
s += "<td>";
s += "<input type='checkbox' name='ck' class='tree-checkbox' />";
s += "<td>" + o.UserInfo.UserID + "</td>";
s += "<td>" + o.UserInfo.UserName + "</td>";
s += "<td>" + o.UserInfo.Cellphone + "</td>";
s += "<td>" + o.DepartmentList.DeptName + "</td>";
s += "</td>";
s += "<td>";
s += "<img alt='' title='修改' onclick='UpdateUserInfo(" + o.UserInfo.UserID + ")' src='image/icon_Edit.gif'/>";
s += "<img alt='' title='删除' onclick='DeleteUserInfo(" + o.UserInfo.UserID + ")' src='image/icon_Delete.gif' />";
s += "</td>";
s += "</tr>";
$("#tableUserInfo tr:gt(0)").remove();
$("#tableUserInfo").append(s);
}
处理程序返回的dt里有5条数据
为什么界面只能显示下一页的第一条数据
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
3条回答 默认 最新
- Go 旅城通票 2016-08-03 06:13关注
$("#tableUserInfo tr:gt(0)").remove();
你这里不是添加一条就删除之后继续添加的了。。这句放到each循环外面$("#tableUserInfo tr:gt(0)").remove();///////////////// $.each(data, function (index, o) { var s = ""; s += "<tr>"; s += "<td>"; s += "<input type='checkbox' name='ck' class='tree-checkbox' />"; s += "<td>" + o.UserInfo.UserID + "</td>"; s += "<td>" + o.UserInfo.UserName + "</td>"; s += "<td>" + o.UserInfo.Cellphone + "</td>"; s += "<td>" + o.DepartmentList.DeptName + "</td>"; s += "</td>"; s += "<td>"; s += "<img alt='' title='修改' onclick='UpdateUserInfo(" + o.UserInfo.UserID + ")' src='image/icon_Edit.gif'/>"; s += "<img alt='' title='删除' onclick='DeleteUserInfo(" + o.UserInfo.UserID + ")' src='image/icon_Delete.gif' />"; s += "</td>"; s += "</tr>"; $("#tableUserInfo").append(s); }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 keil的map文件中Image component sizes各项意思
- ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
- ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
- ¥15 划分vlan后,链路不通了?
- ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
- ¥15 Vue3 大型图片数据拖动排序
- ¥15 Centos / PETGEM
- ¥15 划分vlan后不通了
- ¥20 用雷电模拟器安装百达屋apk一直闪退
- ¥15 算能科技20240506咨询(拒绝大模型回答)