這篇文章主要為大家展示了“json數(shù)據(jù)傳到前臺(tái)并解析展示成列表的示例分析”,內(nèi)容簡(jiǎn)而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“json數(shù)據(jù)傳到前臺(tái)并解析展示成列表的示例分析”這篇文章吧。
創(chuàng)新互聯(lián)專注于企業(yè)全網(wǎng)營銷推廣、網(wǎng)站重做改版、崇仁網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、H5建站、商城系統(tǒng)網(wǎng)站開發(fā)、集團(tuán)公司官網(wǎng)建設(shè)、成都外貿(mào)網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性價(jià)比高,為崇仁等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。
因?yàn)槟承┰?,?xiàng)目中突然需要做自己做個(gè)ajax異步獲取數(shù)據(jù)后動(dòng)態(tài)向表格中添加數(shù)據(jù)的頁面,網(wǎng)上找了半天都沒有 看到現(xiàn)成的,決定自己寫個(gè)例子
1、HTML頁面
<!doctype html> <html> <head> <meta charset="utf-8"> <title>文件柜取件列表</title> <script type="text/javascript" src="/js/jquery-1.11.3.min.js"></script> <script type="text/javascript" src="/js/ai/ai-lib.js"></script> </head> <body> <div class="main pusher"> <form class="form_style"> <div class="fields"> <div class="div_1"> <label for="lbl">取件標(biāo)題</label> <input name="FileTitle" type="text" id="FileTitle"> </div> <div class="div_l"> <label>取件發(fā)文單位</label> <input name="comeDept" id="comeDept" placeholder="" type="text"> </div> <div class="div_l"> <label>投箱時(shí)間</label> <input type="text" maxlength="50" name="sendTime" id="sendTime" placeholder=""> </div> <div class="div_l"> <label>打印人單位</label> <input type="text" maxlength="50" name="printDept" id="printDept"> </div> <div> <label>打印人姓名</label> <input type="text" maxlength="50" name="printUser" id="printUser"> <input type="button" value="查詢" id="btSearch" class="btn_search"/> </div> </div> </form> <div class="table-container"> <table class="ui nine column table celled table-result" id="table-result"> <thead> <tr> <th>hotelSeq</th> <th>文件標(biāo)題</th> <th>條碼編號(hào)</th> <th>發(fā)文單位</th> <th>緊急程度</th> <th>份數(shù)</th> <th>密級(jí)</th> <th>投箱時(shí)間</th> <th>備注</th> </tr> </thead> <tbody id="tbody-result"> </tbody> </table> </div> </div> </body> </html>
2、filebox-print.jsp
$(function () { $('#btSearch').click(function () { var FileTitle= $('#FileTitle').val(); var comeDept= $('#comeDept').val(); var sendTime= $('#sendTime').val(); var printDept = $('#printDept').val();
var printUser=$('#printUser').val(); var tbody=window.document.getElementById("tbody-result"); $.ajax({ type: "post", dataType: "json", url: "<%=path%>/filebox/fileBox!getToDoFileBoxList.action", data: { FileTitle: FileTitle, comeDept: comeDept, sendTime: sendTime, printDept: printDept,
printUser:printUser }, success: function (msg) { if (msg.ret) { var str = ""; var data = msg.data; for (i in data) { str += "<tr>" + "<td>" + data[i].fileTitle+ "</td>" + "<td>" + data[i].fileCode+ "</td>" + "<td>" + data[i].comeDept + "</td>" + "<td>" + data[i].fileEmerg+ "</td>" + "<td>" + data[i].alreadyCount+ "</td>" + "<td>" + data[i].fileSecret+ "</td>" + "<td>" + data[i].sendTime + "</td>" + "<td>" + data[i].remark+ "</td>" + "<td>" + data[i].fileboxId+ "</td>" +
"</tr>"; } tbody.innerHTML = str; } }, error: function () { alert("查詢失敗") } }); }); });
做完之后感覺瞬間就踏實(shí)了不少,這個(gè)禮拜可以好好休息了。俺接觸這個(gè)又學(xué)到了一點(diǎn)前臺(tái)的知識(shí)了。
以上是“json數(shù)據(jù)傳到前臺(tái)并解析展示成列表的示例分析”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
分享題目:json數(shù)據(jù)傳到前臺(tái)并解析展示成列表的示例分析
本文來源:http://chinadenli.net/article14/gidpge.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊(cè)、企業(yè)網(wǎng)站制作、手機(jī)網(wǎng)站建設(shè)、響應(yīng)式網(wǎng)站、面包屑導(dǎo)航、標(biāo)簽優(yōu)化
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)