
Ajax.png
主要來說:
XMLHttpRequest對象中有
事件:onreadystatechange()
屬性:status、readyState
方法:open()、send(string)
設(shè)置請求類型、請求鏈接、是否異步的方法:open()
發(fā)送請求的方法:send()
在用事件監(jiān)聽屬性status=200、readyState=4來獲取數(shù)據(jù)
以上,組織下代碼,理清邏輯就能封裝個簡易版Ajax方法了
主要來說:
XMLHttpRequest對象中有
事件:onreadystatechange()
屬性:status、readyState
方法:open()、send(string)
設(shè)置請求類型、請求鏈接、是否異步的方法:open()
發(fā)送請求的方法:send()
在用事件監(jiān)聽屬性status=200、readyState=4來獲取數(shù)據(jù)
以上,組織下代碼,理清邏輯就能封裝個簡易版Ajax方法了