選單
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

XML 教程

XML 首頁 XML 簡介 XML 如何使用 XML 樹 XML 語法 XML 元素 XML 屬性 XML 名稱空間 XML 顯示 XML HttpRequest XML 解析器 XML DOM XML XPath XML XSLT XML XQuery XML XLink XML 驗證器 XML DTD XML Schema XML 伺服器 XML 示例 XML 測驗 XML 證書

XML AJAX

AJAX Introduction AJAX XMLHttp AJAX Request AJAX Response AJAX XML File AJAX PHP AJAX ASP AJAX Database AJAX Applications AJAX Examples

XML DOM

DOM Introduction DOM Nodes DOM Accessing DOM Node Info DOM Node List DOM Traversing DOM Navigating DOM Get Values DOM Change Nodes DOM Remove Nodes DOM Replace Nodes DOM Create Nodes DOM Add Nodes DOM Clone Nodes DOM Examples

XPath 教程

XPath Introduction XPath Nodes XPath Syntax XPath Axes XPath Operators XPath Examples

XSLT 教程

XSLT Introduction XSL Languages XSLT Transform XSLT <template> XSLT <value-of> XSLT <for-each> XSLT <sort> XSLT <if> XSLT <choose> XSLT Apply XSLT on the Client XSLT on the Server XSLT Edit XML XSLT Examples

XQuery 教程

XQuery Introduction XQuery Example XQuery FLWOR XQuery HTML XQuery Terms XQuery Syntax XQuery Add XQuery Select XQuery Functions

XML DTD

DTD Introduction DTD Building Blocks DTD Elements DTD Attributes DTD Elements vs Attr DTD Entities DTD Examples

XSD Schema

XSD 簡介 XSD 操作方法 XSD <schema> XSD 元素 XSD 屬性 XSD 限制 XSD 複雜元素 XSD 空 XSD 僅元素 XSD 僅文字 XSD 混合 XSD 指示符 XSD <any> XSD <anyAttribute> XSD 替換 XSD 示例

XSD Data Types

XSD String XSD Date/Time XSD Numeric XSD Misc XSD Reference

Web Services

XML Services XML WSDL XML SOAP XML RDF XML RSS

參考手冊

DOM 節點型別 DOM 節點 DOM NodeList DOM NamedNodeMap DOM Document DOM Element DOM Attribute DOM Text DOM CDATA DOM Comment DOM XMLHttpRequest DOM Parser XSLT 元素 XSLT/XPath 函式

XMLHttpRequest 物件


使用 XMLHttpRequest 物件,您可以更新網頁的某些部分,而無需重新載入整個頁面。


XMLHttpRequest 物件

XMLHttpRequest 物件用於在後臺與伺服器交換資料。

XMLHttpRequest 物件是開發者的夢想,因為你可以

  • 更新網頁而無需重新載入頁面
  • 在頁面載入後從伺服器請求資料
  • 在頁面載入後從伺服器接收資料
  • 在後臺傳送資料到伺服器


XMLHttpRequest 物件的方法

方法 描述
abort() 取消當前請求
getAllResponseHeaders() 返回頭資訊
getResponseHeader() 返回特定的頭資訊
open(method,url,async,uname,pswd) 指定請求的型別、URL、請求是否應非同步處理,以及請求的其他可選屬性

method:請求型別:GET 或 POST
url:檔案在伺服器上的位置
async:true(非同步)或 false(同步)
send(string) send(string) 將請求傳送到伺服器。

string:僅用於 POST 請求
setRequestHeader() 向要傳送的頭資訊新增一個標籤/值對

XMLHttpRequest 物件屬性

屬性 描述
onreadystatechange 儲存一個函式(或函式名),在 readyState 屬性每次更改時自動呼叫
readyState 包含 XMLHttpRequest 的狀態。從 0 更改到 4
0: 請求未初始化
1: 伺服器連線已建立
2: 請求已接收
3: 正在處理請求
4: 請求已完成,響應已準備好
responseText 將響應資料作為字串返回
responseXML 將響應資料作為 XML 資料返回
status 返回狀態碼(例如,“404”表示“未找到”或“200”表示“OK”)
statusText 返回狀態文字(例如,“未找到”或“OK”)

×

聯絡銷售

如果您想將 W3Schools 服務用於教育機構、團隊或企業,請傳送電子郵件給我們
sales@w3schools.com

報告錯誤

如果您想報告錯誤,或想提出建議,請傳送電子郵件給我們
help@w3schools.com

W3Schools 經過最佳化,旨在方便學習和培訓。示例可能經過簡化,以提高閱讀和學習體驗。教程、參考資料和示例會不斷審查,以避免錯誤,但我們無法保證所有內容的完全正確性。使用 W3Schools 即表示您已閱讀並接受我們的使用條款Cookie 和隱私政策

版權所有 1999-2024 Refsnes Data。保留所有權利。W3Schools 由 W3.CSS 提供支援