Jquery 通过ajax发送af列表
这就是我到目前为止所尝试的Jquery 通过ajax发送af列表,jquery,ajax,spring,spring-boot,thymeleaf,Jquery,Ajax,Spring,Spring Boot,Thymeleaf,这就是我到目前为止所尝试的 <input id="allPlAccounts" type="hidden" th:value="${allPlAccounts}"/> <script type="text/javascript"> $("#printList").on('click', function () { var customers = ($("#allPlAccounts").val()) $.ajax({
<input id="allPlAccounts" type="hidden" th:value="${allPlAccounts}"/>
<script type="text/javascript">
$("#printList").on('click', function () {
var customers = ($("#allPlAccounts").val())
$.ajax({
type: "POST",
url: "/coopmis/waterTariff/generateReport",
data: JSON.stringify(customers),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
}
});
})
</script>
$(“#打印列表”)。在('单击',函数(){
var客户=($(“#allPlAccounts”).val()
$.ajax({
类型:“POST”,
url:“/coopmis/waterTariff/generateReport”,
数据:JSON.stringify(客户),
contentType:“应用程序/json;字符集=utf-8”,
数据类型:“json”,
成功:功能(响应){
}
});
})
下面您可以看到我的控制器方法
@PostMapping(path = "/coopmis/waterTariff/generateReport",produces = "application/json;charset=UTF-8")
public void getCustomerByBranch(@RequestBody List<PlAccount> plAccountList) {
}
@PostMapping(path=“/coopmis/waterprivate/generateReport”,products=“application/json;charset=UTF-8”)
public void getCustomerByBranch(@RequestBody List-countlist){
}
我想通过ajax将allPlAccounts arraylist发送到spring控制器,如何做到这一点 那么,
System.out.println(plAccountList)是什么呢代码>给予?是否打印所需值?@Swati否,我添加它是否知道终点hit@Swati我从ajax调用中删除了itdebug,检查客户是否具有所需的值?i、 e:console.log(customers)
,然后查看url是否正确。另外,检查post和。那么System.out.println(plAccountList)有什么作用代码>给予?是否打印所需值?@Swati否,我添加它是否知道终点hit@Swati我从ajax调用中删除了itdebug,检查客户是否具有所需的值?i、 e:console.log(客户)
,然后查看url是否正确。此外,还可以检查post和。