CHAPTER 1
■
INTRODUCING JQUERY
8
Including a Remotely Hosted Copy of
the jQuery Library
The second option is to include a copy of the jQuery library hosted on Google Code. This is done in the
hopes that visitors to your web site will have a copy of the library already
cached from another site
including the same file, which decreases load time for your site’s users.
The remote copy is included just like the downloaded copy:
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js">
Using the Google AJAX
Libraries API
Google Code also offers an option for loading jQuery called the AJAX Libraries API (see
http://code.google.com/apis/ajaxlibs). In Google’s words, “The AJAX Libraries API is a content
distribution network and loading architecture
for the most popular, open source JavaScript libraries.”
Using the AJAX Libraries API is simple and straightforward, and this is method that will be used
throughout this book. To include jQuery in your web site using
the AJAX Libraries API, use the following
snippet:
Do'stlaringiz bilan baham: