
Ajax怎么把获取到的数组循环输出在页面上?求大神指教~~~~ 10
AJAX获取到的内容data:[{"phone_id":"2","phone_number":"123456789","phone_time":"2014-10-1000...
AJAX获取到的内容
data:[{"phone_id":"2","phone_number":"123456789","phone_time":"2014-10-10 00:00:00","money":"100","CZ_money_id":"1"},{"phone_id":"1","phone_number":"123456789","phone_time":"2014-10-02 02:13:08","money":"10","CZ_money_id":"5"},{"phone_id":"3","phone_number":"123456789","phone_time":null,"money":"1","CZ_money_id":"2"},{"phone_id":"4","phone_number":"123456789","phone_time":null,"money":"1","CZ_money_id":"2"},{"phone_id":"5","phone_number":"123456789","phone_time":null,"money":"1","CZ_money_id":"2"}]"
我想把他循环输出到:<table id="Table02" align="center" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td colspan="17" class="dv01" align="left">查询结果: </td>
</tr>
<tr>
<th>手机号码</th>
<th>充值时间</th>
<th>面额(元)</th>
</tr>
<tr> 在这里输出,格式对应着上面的th </tr> 展开
data:[{"phone_id":"2","phone_number":"123456789","phone_time":"2014-10-10 00:00:00","money":"100","CZ_money_id":"1"},{"phone_id":"1","phone_number":"123456789","phone_time":"2014-10-02 02:13:08","money":"10","CZ_money_id":"5"},{"phone_id":"3","phone_number":"123456789","phone_time":null,"money":"1","CZ_money_id":"2"},{"phone_id":"4","phone_number":"123456789","phone_time":null,"money":"1","CZ_money_id":"2"},{"phone_id":"5","phone_number":"123456789","phone_time":null,"money":"1","CZ_money_id":"2"}]"
我想把他循环输出到:<table id="Table02" align="center" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td colspan="17" class="dv01" align="left">查询结果: </td>
</tr>
<tr>
<th>手机号码</th>
<th>充值时间</th>
<th>面额(元)</th>
</tr>
<tr> 在这里输出,格式对应着上面的th </tr> 展开
2个回答
展开全部
//先解析你的json数据
var data = eval("("+data+")");
//然后再循环
for(var i=0;i<data.length;i++)
{
//这里拼接HTML代码。
}
先解析你的json,这一步成功了,你就成功了一半了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |