前后数据交互(ajax) -- 初始化页面表格
生活随笔
收集整理的這篇文章主要介紹了
前后数据交互(ajax) -- 初始化页面表格
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
// 初始化員工信息列表
function loadpage ( pageNum ) {var keywords = $("#keywords").val();$("#tbody").html("");if ( isNaN(pageNum) ) {pageNum = 1;}$.$.ajax({type: 'GET',url: contextPath + "/getaccountList/" + pageNum + "/" + pageSize,dataType: 'json',contentType: "application/json;charset='UTF-8'",data: {keywords: keywords },cache: falsesuccess: function () {if( data.code == 0 ){// 系統異常} else if (data.code == 1) {// 成功if ( data.data.size != 0 ) {$("#tbody").html('');$.each(data.data.list, function () {$tr = $("<tr/>");$td1 = $("<td/>").text(item.number == null ? "" : item.number);$td2 = $("<td/>").text(item.nickName == null ? "" : item.nickName);$td3 = $("<td/>").text(item.tel == null ? "" : item.tel);$td4 = $("<td/>").text(item.createTime == null ? "" : item.createTime);$td5 = $("<td/>").text(accountRole(item.roleId));$td6 = $("<td/>").text(item.status == 0 ? "正常" : "停用");$td7 = $("<td/>")$tdai2 = $("<i/>").addClass('iconfont icon-btn reset-pwd').attr({"title": "重置密碼","data-id": item-userId}).html("");$td7.append(choiceStatus(item.userId, item.status, item.nickName)).append($tdai2);$tr.append($td1).append($td2).append($td3).append($td4).append($td5).append($td6).append($td7);
//$tr.append($td1);
//$tr.append($td2);
//$tr.append($td3);
//$tr.append($td4);
//$tr.append($td5);
//$tr.append($td6);
//$tr.append($td7);
轉載于:https://www.cnblogs.com/zsongs/p/5998230.html
總結
以上是生活随笔為你收集整理的前后数据交互(ajax) -- 初始化页面表格的全部內容,希望文章能夠幫你解決所遇到的問題。