Two places to note for Ajax requests

Source: Internet
Author: User

1. Passing parameters in the form of a request string (passed get parameter information) behind the URL address

2. Handling of special symbols such as Chinese, =, &


Handling of special symbols:

Passing some special symbolic information through a get parameter in a browser can be confusing, such as & =.

In order to avoid the misunderstanding of the special symbol, it needs to be encoded and processed.

1). In PHP, you can use the function Urlencode/urldecode to encode and deserialize special symbols, (Url_encode () can convert Chinese into information that the browser can recognize. After the encoded information is the% number followed by two 16 binary number)

2). In JavaScript, you can encode information such as special symbols by encodeURIComponent ().


Encoded information can be used for normal reception, without the need for anti-coding.

encodeURIComponent encoding

# used to flag a specific document location%23

% to encode special characters%25

& separating different values of variables against%26

+ Represents a space in the value of a variable%2b

\ indicates directory path%2f

= used to connect keys and values%3d

? Represents the start of a query string%3f

Each byte unit of the kanji is converted to a "% two hexadecimal number".


Two places to note for Ajax requests

Related Article

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.