Training Guide: Programming in HTML5 with JavaScript and CSS3 Ebook

(Nora) #1

312 CHAPTER 7 Working with forms


After this lesson, you will be able to:
■■Understand basic HTTP protocol actions.
■■Understand how data is sent to the server.

Estimated lesson time: 20 minutes

Understanding web communications


It’s important to understand the roles of the server, browser, and HTTP to develop web appli-
cations. When web communication occurs, the sequence can be generalized into the follow-
ing steps:


  1. The user browses to a website, which causes the browser to initiate a request for a web
    server resource.

  2. HTTP protocol sends a GET request to the web server.

  3. The web server processes the request.

  4. The web server sends a response to the web browser, also by using HTTP protocol.

  5. The browser processes the response, causing a webpage to display.

  6. The user enters data into a form on the webpage and clicks a Submit button that
    causes the data to be sent back to the web server.

  7. HTTP protocol posts the data back to the server.

  8. The web server processes the data.

  9. The web server sends the response back to the browser through the HTTP protocol.

  10. The web browser processes the response, displaying the webpage.


The web server
Web servers originally were responsible for only receiving and handling requests from the
browsers through HTTP. The web server handled the request and sent a response back to the
web browser, and then the web server closed the connection and released all resources that
were involved in the request. Releasing all resources was paramount because the web server
needed to handle thousands of requests per minute. The original webpages were simple,
static HTML pages. The web environment was considered to be stateless because no data was
held at the web server between web browser requests, and the connection was closed after
the response, as shown in Figure 7-1.

Key
Te rms
Free download pdf