Computer / / 2008. 8. 13. 10:08

AJAX

반응형

 1. 서버측

Function GetHTMLBin(URLaddress)

  Dim Http

  Set Http = Server.CreateObject("Microsoft.XMLHTTP")

  Http.Open "GET", URLaddress, False

  Http.Send

  GetHTMLBin = Http.ResponseText

  Set Http = Nothing

End Function

Function BinToText(varBinData, intDataSizeInBytes)    ' as String

  Const adFldLong = &H00000080

  Const adVarChar = 200

 

  Set objRS = CreateObject("ADODB.Recordset")
  objRS.Fields.Append "txt", adVarChar, intDataSizeInBytes, adFldLong

  objRS.Open

  objRS.AddNew

  objRS.Fields("txt").AppendChunk varBinData

  BinToText = objRS("txt").Value

  objRS.Close

  Set objRS = Nothing

End Function


'HTMLBin = GetHTMLBin("http://localhost/DeciWeb/MPC/templates/Reports/comments/LoanComments.asp?View=OT_Loan")

'html = BinToText(HTMLBin,32000)

'response.Write html

 

2. 클라이언트 측


<script language="JavaScript">
    // PostXml
    function PostXml() {
        var req = new ActiveXObject("Microsoft.XMLHTTP");
 
        var str = "";
        str = str +" 0000000";
 
        req.Open("GET", "http://localhost/DeciWeb/MPC/templates/Reports/comments/LoanComments.asp?View=OT_Loan", false);
        req.Send(str);
 
//        var str = BinDecode(req.responseText);
          var str = req.responseText;
//        document.theForm.vHtml.innerHTML = str;
        document.getElementById("theComments").innerHTML = str;
    }
</script>
 
<script language="VBScript">
    '// BinDecode : 바이너리 -> 아스키 변환
    function BinDecode(byval binData)
        dim i, byteChr, str
 
        for i = 1 to LenB(binData)
            byteChr = AscB(MidB(binData,i,2))
            if byteChr > 127 then
                i = i + 1
                str = str & Chr("&H" & Hex(byteChr) & Hex(AscB(MidB(binData,i,2))))
            else
                str = str & Chr(byteChr)
            end if
        next
 
        BinDecode = str
    end function
</script>

이 글은 스프링노트에서 작성되었습니다.

반응형
  • 네이버 블로그 공유
  • 네이버 밴드 공유
  • 페이스북 공유
  • 카카오스토리 공유