【发布时间】:2011-12-14 06:00:38
【问题描述】:
我需要传递整个 html 表格内容并尝试将其作为参数传递给 ajax 调用中的下一个 gsp 页面
jQuery.ajax({
type:'POST',
data:{'table_cart': $("#table_cart").html()},
url: '/gra/ar_request/nextpage',
beforeSend: function() {
jQuery('#templateDiv').html('show spinner')
},
success:function(data,textStatus){jQuery('#templateDiv').html(data);},
error:function(XMLHttpRequest,textStatus,errorThrown){}});
return false;
当我尝试在下一页中检索值时,我遇到了各种错误,例如“XML 格式不正确,需要 img 标签。,;缺少 ..etc”
我只是在尝试执行以下操作以读取下一页上的值
var table_content = ${table_cart}
在值周围加上单引号会产生错误。需要知道如何将一个表格的html内容传递给另一个gsp,有没有更好的方法?
nextpage.gsp 上的错误详情 失踪 ;声明之前 http://cdn.jquerytools.org/1.2.6/full/jquery.tools.min.js 第 29 行
I am doing
<script>
var tbcont = ${rolecart}
</script>
我从操作中打印出控制台上的内容,它具有正确的内容。即表格内的所有标签,我需要对html内容进行编码吗? 控制台内容的准确显示是:
<thead>
<tr>
<th scope="col" style="width: 40%">
<span class="column-sort">
<a href="#" title="Sort up" class="sort-up"></a>
<a href="#" title="Sort down" class="sort-down"></a>
</span>
Role
</th>
<th scope="col" style="width: 55%">
<span class="column-sort">
<a href="#" title="Sort up" class="sort-up"></a>
<a href="#" title="Sort down" class="sort-down"></a>
</span>
Description
</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="width: 40%;"><span style="color: black;">unix_server_read</span></td>
<td style="width: 55%;"><span style="color: black;">Role with UNIX based entitlements having read access</span
></td>
</tr><tr style="color:black"></tr><tr style="color:black"> <td colspan="1">End Date: <input style="width:70px" nam
e="ar_enddate" value="" id="ar_enddate" type="text"><img src="images/icons/fugue/calendar-month.png" height="16" width="16"></td><
/tr><tr style="height:8px"></tr><tr class="even">
<td style="width: 40%;"><span style="color: black;">unix_server_write</span></td>
<td style="width: 55%;"><span style="color: black;">Role with UNIX based entitlements having write access</spa
n></td>
</tr><tr style="color:black"></tr><tr style="color:black"> <td colspan="1">End Date: <input style="width:70px" nam
e="ar_enddate" value="" id="ar_enddate" type="text"><img src="images/icons/fugue/calendar-month.png" height="16" width="16"></td><
/tr><tr style="height:8px"></tr></tbody>
【问题讨论】:
-
你从哪里得到这些错误?请粘贴完整的错误消息、堆栈跟踪和
nextpage控制器操作的正文。