how to get the parameter from a url?

后端 未结 6 1096
夕颜
夕颜 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条回答
  •  我在风中等你
    2021-01-19 08:08

    It may be overkill here, but for URL parsing, I found this useful:

    • https://github.com/allmarkedup/jQuery-URL-Parser

    A jQuery plugin to parse urls and provides easy access to information within them, such as the protocol, host, port, the segments that make up the path and the various query string values.

    In your case, this would boil down to something like:

    jQuery.url.setUrl("http://localhost:8080/steer/trip/create/3").segment("4");
    

提交回复
热议问题