jQuery get last part of URL
You can use the following code to get the last part of the url.:
var value = url.substring(url.lastIndexOf('/') + 1);
var str="url";
str.split("/")[3]
you can use split
I'd suggest:
var URI = 'www.example.com/folder/code/12345/',
parts = URI.split('/'),
lastPart = parts.pop() == '' ? parts[parts.length - 1] : parts.pop();
JS Fiddle demo.