출처: 이웅모 《모던 자바스크립트 Deep Dive》 43장 · 본인 말로 정리

한줄 요약

Ajax = 페이지 전체 새로고침 없이 JS로 서버와 비동기 HTTP 통신해 필요한 부분만 갱신. 전통 API는 XMLHttpRequest, 데이터는 주로 JSON.

JSON

const json = JSON.stringify({ name: '민섭', age: 29 });
const obj  = JSON.parse(json);

XMLHttpRequest 흐름

const xhr = new XMLHttpRequest();
xhr.open('GET', '/api/posts/1');
xhr.send();
xhr.onload = () => {
  if (xhr.status >= 200 && xhr.status < 300) {
    console.log(JSON.parse(xhr.response));
  } else {
    console.error(xhr.status, xhr.statusText);
  }
};

Ajax가 바꾼 것

전통 MPA는 요청→전체 HTML. Ajax는 데이터만 받아 DOM 부분 갱신 → SPA·대시보드 UX 기반.

체크포인트