Reputation: 57
how to get the id of a page.
If you could help.
Thanks
Upvotes: 0
Views: 251
Reputation: 50493
if you're always expecting it to be the last part of the url then you could do this:
var splits = window.location.pathname.split('/');
var id = -1;
if(splits.length > 0)
id = splits[splits.length -1];
Upvotes: 2