window.location.search PropertyOne of the not so commonly-used properties of
For example, in a web address like
the window.location.search property will have all the characters after the "?" including it(?user=2&role=admin).
we can do manipulations on its value or use the values contained in the request parameters to populate the value of the controls on the current page. For example, we have a web address like:
Here's the complete source of the sample:
Still you need to add input validation and error-handling in your code should you
need to adopt this sample code but the code itself is running on a "happy scenario",
if you know what I mean.