Get A Parameter From A Rewritten Url With Javascript
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 www.mysite.com/1/my-event instead of
Solution 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-event
in your example), instead:
varparams = window.location.pathname.split('/').slice(1); // ["1", "my-event"]var id = params[0];
var name = params[1];
Post a Comment for "Get A Parameter From A Rewritten Url With Javascript"