【发布时间】:2014-08-06 04:45:50
【问题描述】:
我需要在数据表中插入一个 AJAX 响应数据。我收到了 AJAX 响应,并且在 AJAX 成功后,我需要在数据表中插入响应数据。
$.ajax({
type: "POST",
url: "macrocall.cgi",
data: { macro:"loadcase_ajax",CGISESSID:$CGISESSID,ph_name:phase_name},
dataType: 'text',
success:function (data)
{
var return_data=data;
alert("return data"+return_data);
}
});
这是返回数据格式。
return data**~93~ARRIAE~BETEA~FRONT_IMPACT~FL 1 - 48 Kmph ~../macro/1176/images/FL1.jpg**
我的 HTML 看起来像,
<html>
<table cellpadding="0" cellspacing="0" border="1" class="display"
id="example">
<thead>
<tr style="background-color: #336699;">
<th><font color="#fff">SNO</font></th>
<th><font color="#fff">TESTG PHASE</font></th>
<th><font color="#fff">PROJECT NAME</font></th>
<th><font color="#fff">IMPACT</font></th>
<th><font color="#fff">LOADCE</font></th>
<th><font color="#fff">IMAGE</font></th>
</tr>
</thead>
<tbody>
<tr>
<td>Response values to be inserted here</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</html>
请建议怎么做..上表是数据表。
【问题讨论】:
-
我已经尝试通过创建一个 td 运行时并将其附加到表中来使用 for 循环结构插入它。这东西有效,但数据表不起作用..数据没有插入数据表中。
标签: jquery ajax datatables html-table