[Javascript] XMLHttpRequest를 이용한 비동기 통신(AJAX)
자바스크립트의 XMLHttpRequest를 사용해 서버와 비동기 통신(AJAX)을 할 수 있다. var xhr = new XMLHttpRequest(); xhr.open('post', '/job'); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.send(JSON.stringify({ 'e_id' : 'E101' })); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { console.log(xhr.responseText); } } 1. XMLHttpRequest 객체를 생성한다. 2. open()에 통신에 사용할 방식(method)과..