I have followed the answer from this great post: How can I get query string values in JavaScript?
However, the issue I am having is that on some occasions, my query string values could contain special characters, for example * + - / etc eg:
?userid=de+8d49b7*8a85a3/222343
The above function does not cater to these. How can I get the query string values and inc the special characters? I have tried:
function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
var prodId = encodeURIComponent(getParameterByName('prodId'));
The solution must work in IE8+ too.
 
     
     
     
    