JavaScript URL Decode function

at. picture at. · Nov 27, 2010 · Viewed 190.7k times · Source

What's the best JavaScript URL decode utility? Encoding would be nice too and working well with jQuery is an added bonus.

Answer

anshuman picture anshuman · Dec 16, 2010

Here is a complete function (taken from PHPJS):

function urldecode(str) {
   return decodeURIComponent((str+'').replace(/\+/g, '%20'));
}