A. Dubey A. Dubey - 1 year ago 97
ASP.NET (C#) Question

How to replace in jQuery asp.net

I have this

function show()
var d = "myform.htm?pass=" + pass+ "&name=" + name;
window.location.href = d;

And on next webform,

function getUrlVars()
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for (var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars[hash[0]] = hash[1];
return vars;

Now when I call

var b = getUrlVars()["name"];

It shows


It is because it contains space

I tried but not able to get that "what should I write there in

Answer Source

To decode use:

vars[hash[0]] = decodeURIComponent(hash[1]);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download