프로그래밍/DB 외

ajax 에서 에러처리 방법

낭만가을 2020. 4. 3. 22:24

$.ajax({    
     type: "POST",   
     url: "/region/regionCityChange",    
     data: param,   //&a=xxx 식으로 뒤에 더 붙이면 됨 
     dataType: "text", 
     success: siguResult, 
     error:function(request,status,error){ 
        alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error); 
       } 
     } 
 ); 
   

와 같이 작성 하면 error 에서 에러가 왜 발생 했는지 알려 줍니다.