how Adding JQuery to Projects using CDN and Local jquery file-trickcode

how Adding JQuery to Projects using CDN and Local jquery file,Download the jQuery.js and host it locally on your Web site,Adding A Copy Of The Jquery Library To The Local Computer,CDN (content delivery network)
Share it:
how Adding JQuery to Projects using CDN and Local jquery file

In this section, you learn Adding jquery to Projects.
Before you can start using jquery, you need to obtain the latest version of the code and add it to your web pages. There are a few ways to do this.
   Download the jQuery.js and host it locally on your Web site
   Use a hosted version from a CDN (content delivery network)

At the time of writing this post, jQuery is available in two lines (1.x and 2.x). Most of the application programming interface (API) remains the same across these two lines. The important change in the 2.x line is that the developer should be aware that jquery 2.x doesn’t support Internet Explorer (IE) 6, 7, and 8.


Adding A Copy Of The Jquery Library To The Local Computer:-


This can be the most basic way to add the jQuery library to your project. I would strongly encourage you to download a copy of the jQuery library to your local computer for development work and testing, and specifically for when an Internet connection is unavailable.

To download and add jQuery, follow these steps:

The official jquery website(http://jquery.com/) always has the most up to date 
the stable version of the library, which can be downloaded right from the home page of the site. When the download is complete, you need to give the JavaScript in an HTML page access to the jQuery library, insert this <script> element into the HTML page, in the <head> section, before any other <script> element where you want to use jQuery.

Example:-

<script src="Scripts/jquery-2.1.1.js"></script>

CDN (content delivery network)

Note:- The CDN approach doesn’t create a local copy of the jQuery library on the local computer, instead you are referring to the jQuery library hosted on CDN servers.

As jQuery’s popularity has grown, Many companies have made the file freely available through their Content Delivery Networks (CDNs). 
There are many CDNs available at your disposal, including these:
These sites offer the file on powerful, low-latency servers distributed around the world for fast download regardless of the user’s location. To use jQuery library files from these CDNs, you need to know the URLs to the respective jQuery files, which can be found on the web sites of the respective CDNs.
Example:
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

                                             Share this article with your friends                                        


Share it:

jQuery

Post A Comment:

0 comments: