<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title></title> <script src="jquery-3.3.1.js"></script> </head> <body> <script> var dianxin="dianxin"; $.ajax({? ? ? ? type:"GET",? ? ? ? dataType:"jsonp",? ? ? ? jsonp: "callback", jsonpCallback:dianxin+"_jsonpCallback",? ? ? ? url:"http://218.95.161.229:8082/wt/appProApprovalAction/app!jsonpBuildLogProList.action?pageIndex=1",// ? ? data:{proName:"項(xiàng)目名稱(chēng)",proId:"項(xiàng)目id",createTime:"創(chuàng)建時(shí)間",statusStr:"項(xiàng)目狀態(tài)"},? ? ? ? success:function (data) {? ? ? ? var txt=JSON.parse(data);? ? ? ? for(i in data){? ? ? ? txt+="<tr>"+? ? ? ? "<td>"+data[i].proName+"</td>"+? ? ? ? "<td>"+data[i].proId+"</td>"+? ? ? ? "<td>"+data[i].createTime+"</td>"+? ? ? ? "<td>"+data[i].statusStr+"</td>"+"</tr>";? ? ? ? ? ? ? ? ? ? }? ? ? ? ?template.innerHTML=txt; ? ? ?}, error:function(XMLHttpRequest, textStatus, errorThrown){ ? ? ? alert("請(qǐng)求失敗"); ? ? ?}? ? ? ? }); </script> <table id="datas" border="1" ?style="border-collapse: collapse">? ? ? ? ? <tr> ? ? ? ?<th>項(xiàng)目名稱(chēng)</th> ? ? ? ?<th>項(xiàng)目id</th> ? ? ? ?<th>創(chuàng)建時(shí)間</th> ? ? ? ?<th>項(xiàng)目狀態(tài)</th>? ? ? ? ? </tr>? ? ?<tr id="template"> ? ? ? <td id="proName"></td> ? ? ? <td id="proId"></td> ? ? ? <td id="createTime"></td> ? ? ? <td id="statusStr"></td>? ? ? ? ? </tr>? ? ? ? </table> ?? </body></html>
使用Ajax get請(qǐng)求數(shù)據(jù),用表格顯示不出來(lái)
cute倩影O_o
2018-10-17 22:55:18