3. 아래를 적용해 보세요.
- csrf 를 enable 시
- 게시판 delete 를 ajax통신으로 구현하시오.
<meta name="_csrf" content="${_csrf.token}"/>
<meta name="_csrf_header" content="${_csrf.headerName}"/>
let token = $("meta[name='_csrf']").attr("content");
let header = $("meta[name='_csrf_header']").attr("content");
$(document).ajaxSend(function(e, xhr, options) {
xhr.setRequestHeader(header, token);
});
let ajaxDelete = function(pnumber) {
$.ajax({
type: "delete",
url: "/board/ajax_delete",
data:
{
'pnumber': pnumber
},
success: function(data, status) {
},
});
};