Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  8] [ 3]  / answers: 1 / hits: 23018  / 13 Years ago, wed, august 10, 2011, 12:00:00

I'm looking for similar function as urlencode() from PHP just in JavaScript. jQuery library is allowed.



Basically, I need to encode the string and then redirect the user to another page just with JavaScript.


More From » php

 Answers
9

There is no function quite matching urlencode(), but there is one quite equivalent to rawurlencode(): encodeURIComponent().



Usage: var encoded = encodeURIComponent(str);



You can find a reference here:



https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeURIComponent


[#90697] Tuesday, August 9, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
yulisa

Total Points: 436
Total Questions: 102
Total Answers: 123

Location: Palau
Member since Tue, May 30, 2023
1 Year ago
yulisa questions
Sun, Jun 20, 21, 00:00, 3 Years ago
Wed, Apr 14, 21, 00:00, 3 Years ago
Fri, Aug 7, 20, 00:00, 4 Years ago
Mon, Mar 23, 20, 00:00, 4 Years ago
;