Add Jquery


Prev Tutorial Next Tutorial

Add Jquery

There are several ways to add jQuery on your web-page. You can download jquery from jquery.com or Include jQuery from a CDN. Blow two method are used for add jQuery;

  • Download from www.jquery.com
  • Include jQuery from a CDN (Content Delivery Network).

Downloading jquery

In this method you download jquery library and host on your website. Jquery library is a single JavaScript file, you need to give path of jquery file on your website;

Add jquery on web-page

<head>
<script src="jquery-1.11.3.min.js"></script>
</head>

jQuery CDN

Another way to add jquery on your web-page is; direct use hosted jquery library files, both Google and Microsoft host jQuery library. Below syntax is used for add jquery library on your website;

Google CDN

<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</head>

Microsoft CDN

<head>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.3.min.js"></script>
</head>

Which method is better ?

Many people downloaded jQuery hosted files from google and Microsoft when they visit other websites; as a result when they visit your website, jQuery files loaded from cache. Due to this website load faster. So use google or Microsoft hosted files is better than host jQuery file on your own website.

What is a CDN?

A content delivery network or content distribution network (CDN) is a large distributed system of servers deployed in multiple data centers across the Internet.

Only for remember: Here lot of files are stored, using CDN you can directly use these files on your website. No need to upload these files on your server.

What is the advantage of using CDN?

When you use CDN get following advantage.

  • It reduces the load from your server.
  • It saves bandwidth.
  • When any user visit on other website it save in browser, as a result next time easily load.

Prev Tutorial Next Tutorial

Advertisements




Download Projects