使用Ajax get請(qǐng)求數(shù)據(jù),并循環(huán)顯示到表格上,哪出錯(cuò)了呀,各位大神幫忙看一下
<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)目名稱",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)目名稱</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>