상세 컨텐츠

본문 제목

[ajax] readState

AJAX

by happynuri 2007. 8. 20. 20:36

본문

function openSendStatus(getPost, urlFileAppl, trueFalse, sendData, cbFunction)
{
    xmlHttp = newXMLHttpRequest();               //XMLHttpRequest 생성
    xmlHttp.open(getPost, urlFileAppl, trueFalse);    //송신방법,URL,통신방법
    xmlHttp.onreadystatechange = function()
    {        //처리상태 변경 발생
        if (xmlHttp.readyState == 4)
        {                     //서버 처리 완료
            if (xmlHttp.status == 200)
            {                    //파일 수신 성공
                cbFunction(xmlHttp);                        //callback 함수
            }
            else
            {
                exceptionControl(xmlHttp);                //예외 처리
            }
        }
    }
    //var conType = "application/x-www-form-urlencoded; charset=UTF-8";
    //xmlHttp.setRequestHeader("Content-Type", conType);
    xmlHttp.send(sendData);      //처리 데이터 송신
}

관련글 더보기

댓글 영역