0
這裏是我的表如何重新加載數據表使用jQuery AJAX
<table class="table table-hover display search dataTable" id="test" cellspacing="0" >
<thead>
<tr>
<th> ID </th>
<th>Name</th>
<th>Age</th>
<th>Email</th>
</tr>
</thead>
<tbody >
<% all_employees.each do |employee|%>
<tr>
<td> <%= check_box_tag 'employee_ids[]', employee.id %> </td>
<td> <%= employee.name %> </td>
<td> <%= employee.age %> </td>
<td> <%= employee.email %> </td>
</tr>
<% end %>
</tbody>
</table>
和我的js
function filtered_employee(group_id){
$.ajax({
url: "/employee_groups/"+group_id+"/associated_employees",
type: "get",
data: {
"id" : group_id
},
success: function(result) {
$('#test').html(result)
},
error: function(result){
$('#test').html(result.responseText)
}
});
}
我用Ruby上點擊一個按鈕軌道4版 軌道正在呼叫此阿賈克斯請求正如預期的那樣得到響應,但是當在ajax中觸發成功時,我會得到一張新的表格,如何解決這個問題?
在此先感謝
我以這種方式嘗試,它在我的查詢中繪製整個頁面(在成功的ajax調用上),它只繪製表 – Rathishkumar
您從哪個視圖返回的視圖'/ associated_employees'?在瀏覽器的開發者控制檯或firebug中,你可以檢查回來的內容嗎?我的意思是它是用'
'標籤返回整個頁面或者簡單地用'整個頁面到 該視圖: 相同的視圖show.html在哪裏渲染該表作爲部分 – Rathishkumar
相關問題