TShopping

 找回密碼
 註冊
搜索
查看: 1399|回復: 3

[教學] javascript xmlhttp 回傳值訊息表示

[複製鏈接]
發表於 2013-6-7 17:23:47 | 顯示全部樓層 |閱讀模式
 
Push to Facebook
The onreadystatechange eventWhen a request to a server is sent, we want to perform some actions based on the response.
The onreadystatechange event is triggered every time the readyState changes.
The readyState property holds the status of the XMLHttpRequest.
Three important properties of the XMLHttpRequest object:
Property
Description
onreadystatechangeStores a function (or the name of a function) to be called automatically each time the readyState property changes
readyStateHolds the status of the XMLHttpRequest. Changes from 0 to 4:
0: request not initialized
1: server connection established
2: request received
3: processing request
4: request finished and response is ready
status200: "OK"
404: Page not found
In the onreadystatechange event, we specify what will happen when the server response is ready to be processed.
When readyState is 4 and status is 200, the response is ready:
  1. xmlhttp.onreadystatechange=function()
  2.   {
  3.   if (xmlhttp.readyState==4 && xmlhttp.status==200)
  4.     {
  5.     document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
  6.     }
  7.   }

複製代碼

 

臉書網友討論
發表於 2013-11-14 00:43:30 | 顯示全部樓層
謝謝版主啊!

版主招募中

發表於 2013-11-14 00:43:30 | 顯示全部樓層
HOHO~~~~~~  


*滑块验证:
您需要登錄後才可以回帖 登錄 | 註冊 |

本版積分規則



Archiver|手機版|小黑屋|免責聲明|TShopping

GMT+8, 2024-3-29 01:13 , Processed in 0.079742 second(s), 23 queries .

本論壇言論純屬發表者個人意見,與 TShopping綜合論壇 立場無關 如有意見侵犯了您的權益 請寫信聯絡我們。

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表