Forum Moderators: open
I'm using this great script that helps me retrieve variables from a URL:
function gup( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
var name = gup( 'name' );
var mail = gup( 'from' ); It works well, however in the variables there are spaces and the '@' sign.
I've looked into some tutorials to try and figure this out, but I just can't seem to get it right.
How can I get it to loop through and replace %20 with spaces, and %40 with @?