type
status
date
slug
summary
tags
category
icon
password
URL
Sep 1, 2022 09:23 AM
send a request to a server
open(menthod,url,async)
- method
- get or post
- url
- server location or file
- ”index.html?key=value&key=value“
- “index.html”
- async
- true or false
send()
- sends the requests to the server
- for get
send(string)
- for post
setRequestHeader("Content-type","application/x-www-form-urlencoded")
- (header,value)
onreadystatechange
XMLHttpRequest.onreadystatechange = callback;
readyState
- 0: request not initialized
- 1: server connection established
- 2: request received
- 3: processing request
- 4: request finished and response is ready
responseText
- get the response data as a string
responseXML
- get the response data as XML data
status
- 200: "OK"
- 403: "Forbidden"
- 404: "Page not found"
statusText
Returns the status-text (e.g. "OK" or "Not Found")