I am trying to get a url parameter using javascript so i can pass the paramter to google maps
The problem is i’m using mod rewrite on the url
instead of
I’ve tried doing an alert but it comes up blank
Here is the javascript function that will work if i don’t rewrite the 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];
}
The rewritten format, with the query-string, isn’t available to your JavaScript.
You’ll have to grab the value out of
location.pathname(/1/my-eventin your example), instead: