Ajax는 jQuery를 임포트 한 페이지에서만 동작 가능하다. 즉, http://google.com/ 과 같은 화면에서 개발자 도구를 열면, jQuery가 임포트 되어있지 않기 때문에 아래와 같은 에러가 뜬다. Uncaught TypeError: $.ajax is not a function → ajax라는 게 없다는 뜻. $.ajax({ type: "GET", url: "http://spartacodingclub.shop/sparta_api/seoulair", data: {}, success: function (response) { console.log(response) } }) GET 방식으로 이 URL에 요청해서 response를 찍어주겠다는 뜻! $.ajax({ type: "GET", url: "..
Ajax 시작하기
Ajax는 jQuery를 임포트 한 페이지에서만 동작 가능하다. 즉, http://google.com/ 과 같은 화면에서 개발자 도구를 열면, jQuery가 임포트 되어있지 않기 때문에 아래와 같은 에러가 뜬다. Uncaught TypeError: $.ajax is not a function → ajax라는 게 없다는 뜻. $.ajax({ type: "GET", url: "http://spartacodingclub.shop/sparta_api/seoulair", data: {}, success: function (response) { console.log(response) } }) GET 방식으로 이 URL에 요청해서 response를 찍어주겠다는 뜻! $.ajax({ type: "GET", url: "..
2022.09.04