Ajax接收伺服器返回的資訊response

來源:互聯網
上載者:User

標籤:image   通過   open   state   signed   資訊   調用   http   接收   

Ajax可以向伺服器發起請求,有去的方式,那麼久必然可疑返回。

伺服器返回的資訊也可以通過Ajax接收。

 

Ajax共有5種狀態:

  1、建立對象,沒有調用open方法

  2、對象發起請求http,已經調用open方法,尚未調用send方法

  3、向伺服器發起請求

  4、從伺服器返回資訊

  5、資訊返回完畢

 

 

 

 readyState屬性(0,1,2,3,4)

 

偵測Ajax狀態:

    對象有一個onreadystatechange,可以偵測當前ajax請求的狀態(1,2,3,4)

Ajax接收返回資訊:

     Ajax有四個屬性可以接收返回資訊:reponseBody、reponseStream、reponseText、reponseXML。

       reponseBody:將回應資訊本文以unsigned byte數組形式返回,唯讀,

       reponseStream:以Ado Stream對象的形式返迴響應資訊,唯讀,

       reponseText:將響應資訊作為字串返回,唯讀

       reponseXML:將響應資訊格式化未XML Domcument對象並返回,唯讀

          常用reponseText 和reponseXML

 

 

Ajax接收伺服器返回的資訊response

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.