1 개요 #
3.1 open() : init request #
httpRequest.open( "GET" // or POST , "/test.jsp?a=bbb&c=ddd" , true // is async ? );
3.2 send() : send request #
// GET 방식(최대4K) httpRequest.send(null); // POST방식 httpRequest.send("a=bbb&c=ddd");
4.1 서버의 응답에 호출될(callback) 함수명을 지정 #
httpRequest.onreadystatechange = readyStateChangeEventHandler; httpRequest.open(...); httpRequest.send(...); function readyStateChangeEventHandler() { ..... }
5 XMLHttpRequest 객체의 상태 #
0 | UNINITIALIZED | 객체만 생성됨, 미초기화된상태(open()호출이 안된상태) |
1 | LOADING | open()호출후 send()호출전 |
2 | LOADED | send()호출후 아직 status와 header 도착전 |
3 | INTERACTIVE | 데이터일부받은상태 |
4 | COMPLETE | 데이터전부받은상태 |