如何将json内容写入jsp表。 [英] How to write json content to jsp table.
本文介绍了如何将json内容写入jsp表。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须编写一个ajax回调函数,其中我有json对象,当我用alert进行测试时它会显示`[object Object],[object Object],[object Object]`。这里每个对象包含6个变量。我必须在每一行中显示每个obj值。我怎么能这样做。
这是我的代码,
I have to write a ajax callback function, in which I have json object , When I test with alert it shows `[object Object],[object Object],[object Object]`. Here each object contain 6 variables. I have to display each obj values in each row . How can I do this.
Here is my code,
if (xmlHttpReqRM.readyState == 4) {
if (xmlHttpReqRM.status == 200) {
var responceeString = xmlHttpReqRM.responseText;
var jsonobj= JSON.parse(xmlHttpReqRM.responseText);
alert(jsonobj);
我的jsp表是这样的,
my jsp table is like this,
<pre lang="HTML">
<div id="tab1">
<table id="flexme1">
<thead>
<tr>
<td width="140"><h3>VehicleNo</h3></td>
<td width="140"><h3>Latitude</h3></td>
<td width="140"><h3>Longitude</h3></td>
<td width="140"><h3>Status</h3></td>
<td width="140"><h3>RDate</h3></td>
<td width="140"><h3>RTime</h3></td>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
我怎么能这样才能帮助我。
How can I do this can any one help me.
推荐答案
下面的代码可以帮助你,
它将帮助你逐个查看数据。
.quach中的.each()
Below code may help you ,
It will help you to go through one by one data.
.each() in jquery
.each(jsonobj,function(){
// 把你的桌子绑在这里。
});
.each(jsonobj, function(){ //Bind your table here. });
这篇关于如何将json内容写入jsp表。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文