关于jQuery,使用getjson传值,返回结果使用字符串拼接

xiaoxiao2021-02-28  123

在很多时候用到了利用js,jQuery ,ajax,得到数据,如下实类 url = "${ctx}/meetingIn/merge/?str=${str}"; $.getJSON(url, function (result) { var html = "<div class='table-responsive'><table class='table table-striped'><thead><tr><th>#</th><th>来源</th><th>会议标题</th><th>上报时间</th><th>会议详情</th></tr></thead><tbody>"; if (result.data.length == 0) { $("#hy").html("被合并会议列表 - 此会议不是合并会议"); } else { var i = 1; $.each(result.data, function () { html += "<tr><td>" + i + "</td><td>" + this.names + "</td><td>" + this.title + "</td><td>" + date(this.createDate) + "</td><td>" + this.content + "</td></tr>"; i++; }); } html += "</tbody></table></div>"; $("#hy_div").html(html); }); 返回json数据,利用循环遍历,然后字符串拼接。
转载请注明原文地址: https://www.6miu.com/read-39886.html

最新回复(0)