Home > Web Front-end > JS Tutorial > Solution to the error that js parameters are affected by special characters_javascript skills

Solution to the error that js parameters are affected by special characters_javascript skills

WBOY
Release: 2016-05-16 17:19:33
Original
1038 people have browsed it

When special characters like `~!@#$%^&*()_ -=[]{}|;':”,./? are used as parameters, if they are not processed, the product will pass the parameters Error.

Workaround:

encodeURI method
encodes a text string into a valid Uniform Resource Identifier (URI). >encodeURI(URIString)

The required URIString parameter represents an encoded URI.


Description
The encodeURI method returns an encoded URI. If you pass the encoding result to decodeURI, the original string is returned. The encodeURI method does not encode the following characters: ":", "/", ";" and "?". Use the encodeURIComponent method for these characters. Encode.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template