status 는 처리후 수행결과를 알 수 있다.
| <SCRIPT LANGUAGE="JavaScript"> <!-- function proc(){ httpReq = getXMLHttpRequest(); httpReq.onreadystatechange = hey ; httpReq.open("GET", "test.php", true); httpReq.send(null); } function hey(){ if(httpReq.readystate==0){ alert("open매소드 호출되지 않음"); }else if(httpReq.readystate==1){ alert("send 매소드가 호출 되지 않는 상태"); }else if(httpReq.readystate==2){ alert("status 와 헤더는 도착하지 않은 상태"); }else if(httpReq.readystate==3){ alert("데이터 일부를 받은 상태"); }else if(httpReq.readystate==4){ if(httpReq.status==200){ alert("요청성공"); }else if(httpReq.status==403){ alert("접근거부"); }else if(httpReq.status==404){ alert("페이지없음"); }else if(httpReq.status==500){ alert("서버오류"); } } } //--> </SCRIPT> <input type="button" value="호출" onclick="proc()"> |


::: 사람과 사람의 교감! 人터넷의 첫 시작! 댓글을 달아주세요! :::