본문 바로가기

이클립스사용법

jquery ajax post 404 에러 값은 받아오는데, 에러날 때

전자정부 프로젝트에서 ajax 타고 조건을 넣어줬다가 데이터를 받아오는 식인데.... 평소에 잘 사용했는데.... 오늘 따라 값이 화면에 표현이 안되고 js에서 자꾸 error가 발생했다.

 

원인은 @ResponseBody 추가를 안해줘서 발생했다!

스프링에서는 @ResponseBody 어노테이션을 추가하면, json 또는 XML 형태로 변환해준다고 한다!

 

 

참고 블로그 :https://developernh.tistory.com/19

 

[jQuery] Ajax() 사용 시 요청처리가 완료되었는데도 404 에러가 발생한 경우

$.ajax( { type: "POST", url: "/test/testUrl", data: JSON.stringify(params), contentType: 'application/json', cache: false, dataType: 'json', success: function(data) { console.log('성공'); }, error: function(jqXHR, status, error) { alert('에러'); } });

developernh.tistory.com

 

 

728x90
300x250