I've got a url like this:
http://www.site.com/234234234
I need to grab the Id after /, so in this case 234234234
/
234234234
How can i do this easily?
Get a substring after the last index of /.
var url = 'http://www.site.com/234234234'; var id = url.substring(url.lastIndexOf('/') + 1); alert(id); // 234234234
It's just basic JavaScript, no jQuery involved.
1.4m articles
1.4m replys
5 comments
57.0k users