Ajax怎么把获取到的数组循环输出在页面上?求大神指教~~~~

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>

//先解析你的json数据
var data = eval("("+data+")");
//然后再循环
for(var i=0;i<data.length;i++)
{
    //这里拼接HTML代码。
}

先解析你的json,这一步成功了,你就成功了一半了

温馨提示:内容为网友见解,仅供参考
第1个回答  2017-06-12
进入while循环时应重置e的值为1
相似回答