I am trying to make a code in javascript which is about IMDB.
When the page loads i want the code to check the URL in the browser bar
and take into a variable only one thing For example when we join
http://www.imdb.com/title/tt0241527/?ref_=nv_sr_1
it should take ONLY the tt0241527
and put it into a variable called searchTerm.
I have searched some posts but i couldnt help myself.
Is it possible for someone to help me test it in my chrome console ??
Lets say that i use this
var pathname = window.location.pathname;
console.log(pathname);
its showing this
/title/tt0241527/
but i want to delete /title/ and the last /
That's my problem
Thanks a lot !