I'm looking for a way to extract the query parameters and their corresponding values from a url.
For example. If I have the URL: http://example.com/home?key=value
How can I find the value of key
I'm looking for a way to extract the query parameters and their corresponding values from a url.
For example. If I have the URL: http://example.com/home?key=value
How can I find the value of key
Use this function. It's inspired from
riot.route.query()
getQuery( [url] )
returns an object containing everykey
,value
pair in the query ofwindow.location.href
or the optionalurl
parameter.