jQuery in Action

Loading content into elements
225
<div>
element with an
id
of
someContainer
. For the final time in this chapter, let's
look at how we do this without jQuery assistance. Using the patterns we set out
earlier in this chapter, the body of the
onload
handler is as shown in listing 8.3.
The full
HTML
file for this example can be found in the file chapter8/list-
ing.8.3.html.
Setting up for the examples
Unlike any of the example code that we've examined so far in this book, the code
examples for this chapter require the services of a web server to receive the
requests to server-side resources. Because it's well beyond the scope of this book
to discuss the operation of server-side mechanisms, we're going to set up some
minimal server-side resources that send data back to the client without worrying
about doing it for real. We'll treat the server as a black box; we don't need or want
to know how it's doing its job.
To enable the serving of these smoke and mirrors resources, you'll need to set
up a web server of some type. For your convenience, the server-side resources
have been set up in two formats: Java Server Pages (JSP) and some in PHP. The
JSP resources can be used if you're running (or wish to run) a servlet/JSP engine;
if you want to enable PHP for your web server of choice, you can use the
PHP resources.
If you want to use the JSP resources but aren't already running a suitable server,
instructions on setting up the free Tomcat web server are included with the sample
code for this chapter. You'll find these instructions in the file chapter8/tomcat.pdf.
And don't be concerned; it's easier than you might think!
The examples found in the downloaded code are set up to use the JSP resources. If
you want to switch the examples to use PHP, do a search-and-replace of all
instances of the string .jsp with .php. Note that not all server-side resources have
been translated from JSP to PHP, but the existing PHP resources should be enough
to let the PHP-savvy fill in the rest of the resources.
Once you have the server of your choicechapter8/test.php (to check your PHP installation). The latter assumes that you
have set up your web server (Apache or any other you have chosen) to use the
example code root folder as a document base.
When you can successfully view the appropriate test page, you'll be ready to run
the examples in this chapter.


Другие страницы

 
Cкачать книги бесплатно без регистрации в электронном виде (pdf, chm, txt).Вы можете читать книги онлайн на нашем сайте литературного портала книг.Большая подборка учебников, пособий, интересных книг.Электронные книги на английском языке скачать бесплатно без смс.