From:
http://www.site.com/example/index.html
How can I get just:
http://www.site.com/example/
And storing it into a variable using Javascript and how using jQuery also. Thanks in advance.
var myURL = "http://www.site.com/example/index.html"; var myDir = myURL.substring( 0, myURL.lastIndexOf( "/" ) + 1);
2.1m questions
2.1m answers
60 comments
57.0k users