I am working on an HTML web page, and in the js, I read the end of the URL and place it in a div eg if the URL is
http://example.com/file.html?postval=Hello, world!
it should post "Hello, world!", unfortunately, it posts "Hello,%20world". how can I fix this?
Use decodeURIComponent
var a = decodeURIComponent('Hello,%20world');
a = 'Hello, world!';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.