HTML5, CSS3, and JavaScript Fourth Edition

(Ben Green) #1

CHAPTER 17. FORMS AND INPUTS 183


In web design, CGI stands for common gateway interface. In other fields, it
could stand for computer generated imagery.


The CGI program receives all the name=value pairs provided by the browser.
It separates them and considers them to decide what the user wants. Then
it builds a webpage, made to order.


CGI can also build images or PDF files on the fly.


17.7.3 Special Encoding


When the browser sends information to the server, it collects together the
names and values from the web form. Mostly it sends it exactly as you typed
it.


Characters like A-Z and 0-9 are transmitted as written.


Spaces are changed into plus signs before being transmitted.


Special characters, like=, are converted into hex codes before being trans-
mitted. YourCGIprogram on the server side will have to change them
back into their original values.


17.7.4 AJAX: Asynchronous JavaScript And XML


Beyond CGI, which refreshes a whole page at a time, we haveAJAX.


AJAX is is closely related to CGI, but it does not involve the sending of
whole pages.


AJAX uses JavaScript to update a small (or large) part of a webpage with
new content from the web.


It might add new comments as they are posted to a blog.


It might display current news headlines or weather alerts.


It might cause new email messages to appear in your web mail account.


All this can happen without resending the whole page from the server.


The details of AJAX are well beyond the scope of this book. We mention
it so you will know it exists and what word to search on when you want to
learn more. It is a commonly-used advanced feature of website design.

Free download pdf