Home >Backend Development >PHP Tutorial >Properties and methods of DOM and XMLHttpRequest objects, domxmlhttprequest_PHP tutorial
|
Description
|
||||||||||||||||||||||||||||
abort() |
Stop current request |
||||||||||||||||||||||||||||
getAllResponseHeaders() |
Return the headers of all responses to HTTP requests as build/values |
||||||||||||||||||||||||||||
|
Returns the string value of the specified header | ||||||||||||||||||||||||||||
open(String “method”, String “url, bollean [asynch], String [username], String [password]) | When calling the established server, the method parameter can be post, get or put. The url parameter can be a relative url or an absolute url. This method also includes 3 optional parameters. | ||||||||||||||||||||||||||||
send(content) | Send a request to the server | ||||||||||||||||||||||||||||
setRequestHeader("header","value") | Sets the specified header to the provided value. open(). must be called before setting any headers |
Method |
Description |
onreadystatechange | This event handler will be triggered every time the state changes, usually calling a javascript function. |
readystate | The status of the request. There are 5 possible values: 1=not initialized, 2=Loading, 3=Loaded, 4=Interacting, 5=Done. |
responseText | The server's response, expressed as a string. |
responseXML | The server's response is expressed as XML. This object is generally parsed into DOM. |
status | Server HTTP status code (200 corresponds to OK, 404 corresponds to not found (not found), etc.) |
statusText | The corresponding text of the HTTP status code (OK or not found (not found), etc.) |
Attribute name |
Description |
childNodes | Returns an array of all child elements of the current element |
firstChild | Returns the first subordinate child element of the current element |
lastChild | Returns the last child element of the current element |
nextSibling | Returns the element immediately following the current element |
Nodevalue | Indicates the read/write attribute representing the element value |
parentNode | Returns the parent node of the element |
previousSibling | Returns the element immediately before the current element |
Method name
|
Description
|
|||||||||||||||||||||
GetElementById(id) (document) |
Get the element in the document with the specified unique ID attribute value
|
|||||||||||||||||||||
getElementsByTagName(name)
|
||||||||||||||||||||||
hasChildNodes() | Returns a Boolean value indicating whether the element has child elements | |||||||||||||||||||||
getAttribute(name) | Returns the attribute of the element, the attribute is specified by name |
Properties/Methods |
Description |
Docment.createElement(tagName)
|
The createElement method on the document object can create an element specified by tagname. If the string DIV is used as a parameter, a DIV element will be generated. |
Docment.createTextNode (text) | The createTextNode method on the document object creates a node containing static text. |
|
appendChild adds the specified node to the current node's child node list (as a new child node). For example: you can add an option element as a child node of the select element. |
|
These methods set the value of the name attribute in the element |
|
|
|
This method inserts the node newNode as a child node of the current element in front of the targetNode element |
|
This method removes the attribute name from the element |
|
This method removes the child element childNode from the element |
|
This method replaces the node newNode with oldNode |
|
This method returns a Boolean value indicating whether the element has child elements |