A complete URL consists of the following parts:
Scheme: Communication protocol, commonly used are: Http/ftp.
Host: Server (computer) domain name or IP address
Port: Ports, integers, optional, omit when using default port, HTTP default port is 80.
Path: A character separated by 0 or more "/" symbols, typically used to indicate a directory or file address of a host
Query: Queries, optional, for dynamic web pages such as CGI, ISAPI, php/asp/jsp/asp. NET and other technology-made web pages) pass parameters, separated by the "&" symbol, each parameter's name and value are separated by the "=" symbol
Fragment: A fragment of information, a string that specifies a fragment in a network resource. For example, there are multiple noun interpretations in a Web page, and you can use fragment to navigate directly to a noun interpretation.
Ii. differences between get requests and post requests
(1), GET request no request header, the POST request to have the request header, the request will be brought on the Content-type tells the server post data format and URL parameters of the same data
(2), the data sent by the post in the request body, the user can not see; Get the data sent in the address bar, the user will see, unsafe
(3), when the privacy data related to the use of Post request more secure, send a large amount of data with post, send a small amount of data with get
XMLHttpRequest return value type has XML and JSON
JS parsing XML format
1. Creating XML objects based on XML text content
1 functioncreatexml (data) {2 3 if(!data) {4 5 return NULL;6 7 }8 9 varXML =NULL;Ten One Try{ A -XML =NewActiveXObject ("Microsoft.XMLDOM"); - the xml.loadxml (data); - -}Catch(e) { - + Try{ - +XML = (NewDomparser ()). parsefromstring (data) A at}Catch(e) { - - return NULL; - - } - in}
2. Get the text content of the element node
1 functiongetnodetext (node) {2 3 if(window. ActiveXObject) {4 5 returnNode.text;6 7}Else{8 9 if(Node.nodetype = 1){Ten One returnnode.textcontent; A - } - the } - -}
3. Get the attributes of an element
1 functionGetnodeattribute (node,attrname) {2 3 if(window. ActiveXObject) {4 5 returnNode.getattributenode (attrname);6 7}Else{8 9 if(Node.nodetype = = 1){Ten One returnNode.attributes[attrname] A -}Else{ - the returnundefined; - - } - + } - +}
The difference between AJAX-related--get requests and post requests