how to get the parameter from a url?

后端 未结 6 1075
夕颜
夕颜 2021-01-19 07:11

i have a url like this. http://localhost:8080/steer/trip/create/3. where in my page i want to get value \"3\" using the jquery . please help me

6条回答
  •  Happy的楠姐
    2021-01-19 07:58

    This will output "3" or basically the whole last segment of the url after the last "/" slash.

    var urlsegment = top.location.href.match(/([^\/]+)$/)[1]
    

提交回复
热议问题