VBScript的Ajax非同步使用說明
前言
vbscript裡的ajax,一直以來我都用非同步,為什麼呢??因為好控制,而且使用到機率少之又少,所以就不花心思去研究了 但是這幾天莫名其妙,有大量使用他,所以決心好好地再研究一下,非同步使用方式,希望下次別再遇到困難點。
非同步語法範例
function jVBPost(sUrl,dataStr,bSync)
set xmlHttp =CreateObject("Microsoft.XMLHTTP")
xmlHttp.open "POST",sUrl,bSync
xmlHttp.onreadystatechange = GetRef("OnReadyStateChange")'使用非同步必備
xmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlHttp.send dataStr
end function
Sub OnReadyStateChange()
If xmlHttp.readyState = 4 Then
alert("Done")
End If
End Sub
結語
標題說使用說明,你好像沒說明什麼耶。
謎之音:廢話大家都火燒屁股了,直接一點,要說以後再說bye
Louis的標籤: vbscript