I want to get the location in a URL (localhost: port/: location). For example, if the URL is localhost:8080/show/myplace/
I want to extract myplace
. How to do this in javascript?
Try below code
var location = window.location.pathname.split('/').slice(-1)[0];
This will return the part of URI you want.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments