What is JQuery?
Followings are some of the advantages for jquery:
- easy to learn
- simple syntax
- large open source library
- ajax support
- lots of jquery plugins are available to use
- great documentation
Why should I use JQuery?
Jquery provides better way to interect with dom elements, it is easy to create animations, widgets and dynamic web segments using ajax.
Without reinventing a wheel you have access to a library which is maintained by many developers you get the best. Using jquery you can perform following different operations:
- easy to interect with form elements
- easy to modify and play with html elements
- easy to create async calls using ajax
- easy to create animations
- easy to make changes to css property of an element
- easy to create plugins, form validation etc..
How do I install JQuery?
Following is a sample html page where we installed jquery library in our html page:
In above code, we added cdn url for jquery check out the following line in above html page.
What is cdn url?
CDN known as content delivery network is basically proxy servers spread across the world. Lets understand the concept of data.
You have a website hosted on a webserver. Your server is located in toronto. Your website is seen by many people across the world.
If a user from india is accessing your website. Your website takes a little longer time to download this assets as they are hosted on toronto based server.
Using cdn if you serve your assets then your website speed will be improved. How? Well, now you that cdn's are basically proxy servers spread across the world.
Which ever server is located to user's country your assets will be downloaded from that proxy server instead of original server located in toronto.
Similarly, jquery also provides cdn so that you can use the cdn url in your website directly.
Disadvantage of using cdn
One of the disadvantage of cdn is that if file hosted on cdn is unavailable because of server failure your website will no longer have access to that file and your website might break.