Including jQuery in Web Pages - PHP and Jquery

To use jQuery in a project, the library needs to be loaded in your HTML document to give your script access to the library’s methods. If the library is not loaded first, any scripts using jQuery syntax will likely result in JavaScript errors. Fortunately, loading jQuery is very simple, and there are several options available to developers to do so.

Including a Downloaded Copy of the jQuery Library

The first option for including jQuery in a project is to save a copy of the library within your project’s file structure and include it just like any other JavaScript file:

<script type="text/javascript" src="js/jquery-1.4.2.min.js"/script>

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:

<script type="text/javascript">

Using the Google AJAX Libraries API

Google Code also offers an option for loading jQuery called the AJAX Libraries API. 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 . To include jQuery in your web site using the AJAX Libraries API, use the following snippet:

<script type="text/javascript"src=""/script>
<script type="text/javascript">


All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

PHP and Jquery Topics