Doctor
Doctor

Reputation: 57

How to get the ID of current page

how to get the id of a page.

If you could help.

Thanks

Upvotes: 0

Views: 251

Answers (1)

Gabe
Gabe

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

Related Questions