• jQuery 에러 리포팅 , Ajax 디버깅 ( JS , ASP ) - 오류메시지 확인하기

    2016. 10. 28.

    by. Yo.



    Jquery 를 이용한 에러 리포팅 소스


    //Ajax 호출 함수. 예시.
    function detailView()
    {
         $.ajax({
              type: "POST",
              dataType: "xml",
              url: "xxx.asp",
              data: { mode : "DETAIL"},
              success: function(xmlRS){
                  // 성공처리
              }
              ,error: function(xhr, ajaxOptions, thrownError){
                   //에러처리
                   fnSendErrorReport(xhr.responseText);
                   alert("Detail Load Error");
              }
         });
    }
    
    // 에러 리포팅 함수.
    function fnSendErrorReport(errorMsg)
    {
         $.ajax({
              type: "POST",
              dataType: "text",
              url: "errorReport.asp",
              data: { mode : "ERRORREPORT", errorMsg : errorMsg }
         });
    }
    
    If mode = "ERRORREPORT" Then
         errorMsg = Request("errorMsg")
     
         MailBody = "domain : " & dom & " ("& Date() & " "  &hour(time) &":"& minute(time) &":"& second(time) &")" & vbCrlf
         MailBody = MailBody  & "error Msg : " & errorMsg " & vbCrlf
         If errorMsg<> "" Then
              cdoEmailResult = fnCdoEmailComponent("보낸", "받는", "", 업체명 & " Error Report ", MailBody,"")
         End If
    End if
    



    댓글