One of the underutilized areas of JavaScript is client-side integration


One of the underutilized areas of JavaScript is client-side integration with CGI and server-side databases.

With JavaScript’s capability to validate information and keep a running total of items and prices, it can serve as a powerful tool to reduce the dependence on CGI scripts in generating catalog pages and order forms for users, thereby reducing the load on the server and the user’s time spent on waiting for client-server communication.

If it was just a matter of hard wiring the JavaScript code


If it was just a matter of hard wiring the JavaScript code with the product items, this would be a simple-albeit limited-project.
But it is designed to work with a database that can change in content and size from day-to-day. This is where CGI becomes a necessary companion to JavaScript.

JavaScript is a lightweight object-based scripting language


JavaScript is a lightweight object-based scripting language created by Netscape Communications Corporation for developing Internet applications. JavaScript is lightweight in that there isn’t a great deal to learn and you can be productive with it very quickly, in contrast to much more complex languages such as Java.
As a scripting language, JavaScript is meant to tell an application what to do. Unlike languages used to create applications, it cannot do anything without the application.

You can develop server applications or client applications with JavaScript


You can develop server applications or client applications with JavaScript.Here, the term “server” refers to the computer where your Web pages reside.
And the term “client” refers to the browser application that loads and displays your Web pages.

You can embed JavaScript statements in Web pages


You can embed JavaScript statements in Web pages, which are written in HTML (Hypertext Markup Language).
JavaScript is an extension to HTML that lets you create more sophisticated Web pages than you ever could with HTML alone.

Strictly speaking, HTML is a Standard Generalized Markup Language


Strictly speaking, HTML is a Standard Generalized Markup Language (SGML), Document Type Definition (DTD). An SGML document has three parts. The first part defines the character set to be used and tells which characters in that set distinguish text from markup tags.
Here,the Markup tags specify how the viewer application, or browser, should present the text to the user.

Most HTML browsers assume a common definition about the character set used


Most HTML browsers assume a common definition about the character set used, and about which characters distinguish text from markup tags.
They also generally agree about a core set of legal markup tags. They then diverge on which additional new markup tags to permit.

The Common Gateway Interface (CGI) provides a mechanism for a program on the server


The Common Gateway Interface (CGI) provides a mechanism for a program on the server to interact with the client’s browser. You can use any language to write CGI programs, and CGI programs may be interpreted (PERL scripts, for instance) or compiled (C or C++).
One popular use of CGI is in hit counters-programs that modify the page to show how many times that page has been visited. Another popular use of CGI is in form handling, where a program on the server reads the data from the user input fields and does some work based on that data.

JavaScript, which does its work in the client’s browser, cannot entirely replace CGI


JavaScript, which does its work in the client’s browser, cannot entirely replace CGI. For instance, a hit counter has to update a file on the server so it can remember how many times the page has been visited by all visitors.
That’s a little difficult for JavaScript, but a JavaScript Web page can keep track of how many times a given visitor has visited the page. So can CGI, but only if given an endless supply of disk space on the server.

JavaScript can do a lot of the same things CGI can do


JavaScript can do a lot of the same things CGI can do, and it can often do them much more efficiently. For example, JavaScript can do form validation more efficiently than CGI.
When a non-JavaScript page has user input fields, it sends all the field values to a CGI server application. The CGI application then has to figure out whether the data in each field makes sense before doing something with the data.