The perfect solution is to automatically change the ampersands and ampersands in the parameters passed by js.

Source: Internet
Author: User
The following small series will bring you a perfect solution for the automatic change of the plus sign and & amp; sign in js transmission parameters. I think this is quite good. Now I will share it with you and give you a reference. Let's take a look at the following small series to bring you a perfect solution for the js Transmission Parameters plus the number and the automatic change of the number. I think this is quite good. Now I will share it with you and give you a reference. Let's take a look at it with xiaobian.

Use the get method in the action to obtain the parameter. If the parameter contains "+", it must be processed. Otherwise, it will become a space in the background.

Solution:

1. Use the post method instead;

2. Use url = encodeURI (XXX) in js and decode it again in the background;

3. Replace the escape directly when passing parameters or directly write the escaped code.

Data = "a + B ";
Data = data. replace (/\ +/g, "+ ");
Data = data. replace (/\ &/g ,"&");

Or:

Data = "a + B ";
Data = "a & B ";

The above is the perfect solution provided by the mini-editor for everyone. All the content of the methods for automatically changing the numbers and numbers in js transmission parameters is now available ~

For more information about how to perfectly solve the problem of automatically changing the ampersands and ampersands in js parameters, refer to PHP!

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.