I need to capture a parameter from a URL, for example:
http://site.com/paginas/**nome-da-pagina**
I need to capture page-name with JS or jQuery.
I need to capture a parameter from a URL, for example:
http://site.com/paginas/**nome-da-pagina**
I need to capture page-name with JS or jQuery.
How do you want the value after the last slash, using the location.href
and the lastIndexOf function that returns index of the last position of the value that was passed in this case to /. + 1 (because the index starts at zero) to get it from the bar.
var url = location.href.substring(location.href.lastIndexOf('/') + 1)
alert(url);