background
|
|
Random

Computer
|
|
Up Image
Navigation
Search this Site
Enter your search terms

Site Breadcrumb - You are here
|
Reference   JavaScript Code Library

HTTP 1.0 specifies a format for GET CGI action (<form method="GET" action="someURL">), which appends relevant data to the end of an executable URL in the format URL?key1=value1&key2=value2&.... This same CGI functionality can be mimicked by JavaScript on the client side where available, thereby saving server resources. This library module simplifies the JavaScript processing of client-side GET queries.

[Note: Netscape has posted a similar script for 4.0 browsers on its site. This script is based on Netscape's code in spirit, but extends its functionality by being compatible with almost every JavaScript browser.]

Method:

  • createRequestObject()
    This is the method that parses the GET query. It reads the location of the resulting page, extracts the GET query from the end of the URL, and then parses the GET query into an associative array that can be used by other scripts on the page. It returns false if no data is received.

Usage:

Add the code to your page. The variable FORM_DATA is an associative array (hash) that contains your parsed GET information:

FORM_DATA [ key ] = value;

License: This code is released under the GNU Library General Public License.

Cut, paste, and enjoy!