The difference between AJAX-related--get requests and post requests

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.