Using URLSearchParams is simple.
Use this code:
Note: If a parameter is present several times (?foo=lorem &foo=ipsum), to get the first value as (lorem).
This function is case-sensitive.
Repeating the regular expression search every time the script wants to access a parameter is completely. One single function to split up the parameters into an associative-array style object. Not working with the HTML 5 History API, this is only necessary once per page load.
To handle style-array query strings.
You can use this:
- To retrieve all parts of URL, including anchor, host, etc.
- It can be used with or without jQuery.
The jQuery plugin is different on elements.
The syntax is: