비동기1 ajax로 서버와 통신하기 Spring, json데이터 서버에서 데이터 보내주기 @GetMapping("/study")// 클라이언트에서 요청할 url @ResponseBody public List study() { // List는 반환할 데이터타입 List list = new ArrayList(); return list; } 서버로부터 데이터 받아오기! $.ajax({ type: "get", url:"서블릿 주소", dataType: "json",// 받을 데이터 타입 컨트롤러에서는 @ResponseBody를 붙여주자! success: function(res){ console.log("받아온 데이터", res); // 여기서 받은 데이터 처리하기 }, error: function(req, status, error){ // 에러메세지 확인하는 부분 // co.. 2023. 5. 16. 이전 1 다음