How to load Ajax Libraries from Google Code?

Google code is hosted a lot Ajax libraries, it’s free load it from any server or website. Here are the list of Ajax libraries provided so far.

  1. jQuery
  2. jQuery UI
  3. Prototype
  4. script_aculo_us
  5. MooTools
  6. Dojo
  7. Yahoo! User Interface Library (YUI)

Why need to load Ajax library from Google Code?

Sometime a lot people asking about why should load Ajax library from Google code? Basically, there are two obvious benefits :

  1. Save bandwitdh – Google server is faster than your server , library load very fast from Google code.
  2. Cache – High chance Google Ajax library is cached if user had visited some websites which deliver from Google code. It will increase your website response time.

Example to load JQuery library from Google code.


<script src="http://www.google.com/jsapi"></script>  
<script type="text/javascript">  

    google.load("jquery", "1.2.6");  
  
    google.setOnLoadCallback(function() {  
          //your code
    });  
         
</script>  

Alternatively, you can also include a direct link like this


<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"
type="text/javascript"></script>  

Reference

  1. http://code.google.com/apis/ajaxlibs/documentation/index.html

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
4 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
4 Comment authors
vickyRaghuJefferey WeinraubSitthykun Recent comment authors
newest oldest most voted
vicky
Guest
vicky

thank you bro……….

Raghu
Guest
Raghu

Thanks a lot..

Jefferey Weinraub
Guest
Jefferey Weinraub

Thanks for sharing this…

Sitthykun
Guest
Sitthykun

Great!!

Thanks you. :)