Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 通过ajax发送af列表_Jquery_Ajax_Spring_Spring Boot_Thymeleaf - Fatal编程技术网

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和。