$(function () { let path = lxd.parseUrl(window.location.href).pathname; let reg = /(?<=\/h_news\/).*?(?=.html)/; $.ajax({ url: `http://192.168.2.45:8033/news/h/${path.match(reg)}/`, data: { }, type: "get", error: function (error) { $(".loading").html("获取更多的评论,请下载大联考app").show(); }, success: function (res) { let { comments } = res.data; let father = document.createDocumentFragment(); Array.from(comments).forEach( item => { let str = `
${item.user_name}
${item.like_count}
${item.content}
${item.delay_time}
`; $(father).append(str); } ) $("#detail").append(father); $(".loading").html("获取更多的评论,请下载大联考app").show() } }) })