我需要通過一個完整的HTML表中的內容,並試圖把它作爲一個參數去下一個GSP頁面的Ajax調用傳遞一個表HTML內容
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標籤,缺少..等等」
我只是試圖做下面的讀取值在下一頁
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>
等等......什麼? – dbrin
你從哪裏得到這些錯誤?請粘貼完整的錯誤消息,堆棧跟蹤和'nextpage'控制器動作的主體。 – socha23