jquery dataType error

정하윤·2023년 7월 8일
0
 else {
				$.ajax({
					url: "modify",
					type: "post",
					dataType : "json",
					contentType : "application/json;charset=UTF-8",
					data: JSON.stringify(data)
  • 이러한식으로 데이터값을 보내주고 다시올때 json이 아니라서 실패라고 나오는 것 같았다.

그리하여

 else {
				$.ajax({
					url: "modify",
					type: "post",
					contentType : "application/json;charset=UTF-8",
					data: JSON.stringify(data)
  • dataType를 지워주면 해결이 된다.
  • void, String일 경우에는 받아오지 못하지만return 타입이 Map형식의 경우에는 data타입이 json으로 설정이 되어도 받아와지는 것 같다.

0개의 댓글