💎Ajax 오류
- Request with GET/HEAD method cannot have body 오류에도 나와있듯이
get방식은 ↓ 형태의 모양으로 데이터를 보낼수없어서 오류가난거였다..
fetch("/Administrator/declaration/pesitter",{
method :"get",
headers : {"Content-Type" : "application/json"},
body : petsitterNo
})
.then(resp => resp.text())
.then(result =>{
if(result >0){
alert("성공")
}else{
alert("실패");
}
})
get방식은 데이터를 보낼때 쿼리스트링 형식으로 보내야한다 ↓ 형태의 모양
fetch("/comment?boardNo=" + boardNo)
.then(response => response.json())
.then(cList => {
🏆 해결!
오류가 났던 코드에 method를 post방식이나 다른 방식으로 바꾸면 오류가 해결된다!!
기본을 잊지말자😅😅!!