请问如何将后端返回的json数据呈现到页面上面呢,如后端返回的json数据为:
{
"code" : 200,
"message" : "数据操作成功。。。",
"data" : {
"total" : 8,
"rows" : [ {
"id" : 1045,
"username" : "test007",
"sex" : "W",
"email" : "2781881392@qq.com",
"isdel" : 0,
"createTime" : "2025-06-12 15:57:44",
"updateTime" : "2025-06-12 15:57:44"
}, {
"id" : 1046,
"username" : "test008",
"sex" : "W",
"email" : "2781881392@qq.com",
"isdel" : 0,
"createTime" : "2025-06-12 15:57:44",
"updateTime" : "2025-06-12 15:57:44"
} ]
},
"currentTime" : "2025-06-15 20:46:28"
}
回复
可以重写一下点击事件
$(function() {
$('.pager a').click(function() {
console.log($(this).attr('disabled'))
if ($(this).attr('disabled') == 'disabled') {
return false;
}
let url = window.location.href
console.log(url)
let cutPoint = url.lastIndexOf("/")
console.log($(this).html())
let nextUrl = url.substr(0, cutPoint) + "/" + $(this).attr('page-id')
console.log(nextUrl)
window.location.href = nextUrl
})
});
function currentPage(currentPage) {
/*
触发页码数位置: Page/js/jquery.z-pager.js 64行
*/
console.log("当前页码数:" + currentPage)
if (!isloading) {
showData(currentPage)
}
}
complete: e => {
isloading = false
}
回复