42
Chapter 1
Since the browser handles sending requests, it’s also responsible for getting responses
back from the server. Let’s see what the browser is doing in the Boards app:
The browser gives the server’s response to your JavaScript
1
The browser displays the Boards app to Katie
2
The browser runs the getBoardsSold() function
3
The browser runs the createRequest() function
<html>
.
.
.
</html>
boards.html
h1, h2 {
fon
col
}
p {
boards.css
Web Browser
Internet Explorer
Firefox
Opera
Safari
Mozilla
Here’s what Katie sees.
Here’s
what you
provide
to the
web server.
The browser retrieves the HTML
and CSS from the web server...
Web Browser
Internet Explorer
Firefox
Opera
Safari
Mozilla
Katie
clicks this
button...
...and the browser sees that
onClick is attached to the
getBoardsSold() function.
Web Browser
Internet Explorer
Firefox
Opera
Safari
Mozilla
getBoardsSold()
createRequest()
getBoardsSold()
It’s actually the web
browser that is “running” all
your JavaScript code.
createRequest() counts
on the browser to help it
create a request object.
JavaScript
...and turns them into this.
The getBoardsSold()
function calls the
createRequest() function.
web browsers have a lot to say