I need to get class name of my view from js.
say my url is
http://localhost/test/index.php/mytest/newtest/34
here newtest is the name of view class. I want to get this class name from my js. I have searched for it on google but didn't find anything useful.
Thanks in advance.
var pathArray = window.location.pathname;
pathArray = pathArray.replace(/^\/|\/$/g, '');
pathArray = pathArray.split( '/' );
console.log(pathArray);
With this Javascript you will get all parts from your url as array. There you will know which element is the one you are looking for..