티스토리 뷰

728x90
반응형

 

 

 

jquery에서 ajax로 request.GET, request.POST 호출하는 방법!

 

$.ajax({
    type : 'GET', //POST도 가능
    url : 'domdom.tistory.com', //request URL
    data : {'message': 'hello? my name is domdomi!'}, // 파라미터
    error : function(error) {
    	//request URL 쪽에서 응답에러가 뜨는 등 에러가 났을 경우
        console.log("에러띠..");
    },
    success : function(response) {
    	//정상적으로 response를 받아온 경우
        console.log(response);
    },
    complete : function() {
    	//ajax 호출이 끝난 후의 행동
        console.log("완료되었습니다");
    }
});

 

728x90
반응형
댓글