Spring Security CSRF Token not working with AJAX

前端 未结 3 1012
南方客
南方客 2020-12-15 12:18

I have a problem in my spring boot app with the csrf token.

I have a form where I can edit a Person. A Person can have

Let us now imagine that the person has

3条回答
  •  长情又很酷
    2020-12-15 12:52

    Another way, you can use the following code:

    $.ajax({
        url : './delete/car',
        headers: {"X-CSRF-TOKEN": $("input[name='_csrf']").val()},
        type : 'POST',
        success : function(result) {
            alert(result.msgDetail);
        }
    })
    

提交回复
热议问题