我有一個名爲「cutleryCustomerSearch」,其中包括視圖(替換)片段:在這個片段,我有我喜歡通過AJAX更新表如何從控制器訪問片段中的片段?
<div id="content">
<div th:replace="fragments/customerSearch :: customerSearch"></div>
</div>
:
<table id="customersTable" th:fragment="customersTable">
我如何必須設置處理ajax請求的我的控制器方法的返回值?目前我有(不工作):
return "cutleryCustomerSearch :: customerSearch/customersTable";
但它沒有設置內容,它只是刪除表。 它只是工作正常,直到我fragmentize「customerSearch」。
這裏我的Ajax請求:
$.ajax({
type : 'POST',
cache : false,
url : form.attr('action'),
data : form.serialize(),
success : function(data) {
$("#customersTable").html(data);
}
});