Usually, GET information is evaluated on the server side, but JavaScript does also have access to this information via its location.search property. However, the data there is in name-value pairs. The following code decodes this data by using the JavaScript split() method. The resulting associative array is then shown, just to prove that it works as expected; see Figure 2.1 for the output. Parsing the Query String (querystring.html)
Figure 2.1. The data from the query string is parsed and shown. |