44
Chapter 1
Now what
do I do?
Web Browser
Internet Explorer
Firefox
Opera
Safari
Mozilla
The browser gets the response from the server, but won’t do anything with
that response unless you tell it to. So we need to gure out a way to let the
browser know to run our updatePage() function once it gets a response.
What should the browser do with the server’s response?
JavaScript
PHP script
Somehow, we need to tell the
browser to run updatePage()
when it gets a response from
the server.
The server gets a request
from the browser,
based on our code in
getBoardsSold()...
...and then the server
sends its response back
to the web browser.
The browser gets
the response, but
doesn’t know what
to do with it.
Once we get the browser to
run updatePage(), we can
use JavaScript to update
the Boards report.
<script>
var request...
function
updatePage() {
...
}
</script>
<?php
require(‘lib.php’);
function go() {
$myVar = ...
return ...
}
?>
updatePage()
Boards
Sold
Cash for
Slopes
Number of
Boards Sold
<script>
var request...
function
getBoardsSold()
{
...
}
</script>
Request Total
Boards Sold
In just a few pages, you’ll learn
about how to use the DOM-the
Document Object Model-to make
changes like this to your web page,
all without any page reloads.
talking to the browser