我有一个名为“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);
}
});