I've got a url like this:
http://www.site.com/234234234
I need to grab the Id after /, so in this case 234234234
How can i do this easily?
I've got a url like this:
http://www.site.com/234234234
I need to grab the Id after /, so in this case 234234234
How can i do this easily?
You could just use window.location.hash to grab the id.
var id = window.location.hash;
I don't think you will need that much code to achieve this.
const url = "http://www.example.com/1234"
const id = url.split('/').pop();
Try this, it is much easier
The output gives 1234
Try this
var url = "http://www.exmple.com/234234234"
var res = url.split("/").pop();
alert(res);