May 28, 2008
2:45 am | Last updated: May 28, 2008 at: 2:47 am

You can access the libraries in two ways, and either way we take the pain out of hosting the libraries, correctly setting cache headers, staying up to date with the most recent bug fixes, etc.

The first way to access the scripts is simply be using a standard <script src=".."> tag that points to the correct place.

For example, to load Prototype version 1.6.0.2 you would place the following in your HTML:

&lt;script src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js"&gt;&lt;/script&gt;

The second way to access the scripts is via the Google AJAX API Loader's google.load() method.

Here is an example using that technique to load and use jQuery for a simple search mashup:

<br />&lt;script src="http://www.google.com/jsapi"&gt;&lt;/script&gt;<br />&lt;script&gt;<br />// Load jQuery<br />google.load("jquery", "1");<br /><br />// on page load complete, fire off a jQuery json-p query<br />// against Google web search<br />google.setOnLoadCallback(function() {<br />$.getJSON("http://ajax.googleapis.com/ajax/services/search/web?q=google&amp;;v=1.0&amp;;callback=?",<br /><br />// on search completion, process the results<br />function (data) {<br />if (data.responseDate.results &amp;&amp;<br />data.responseDate.results.length&gt;0) {<br />renderResults(data.responseDate.results);<br />}<br />});<br />});<br />&lt;/script&gt;<br />

Pages: 1 2 3

Loading

Contextual Related Posts:

No comment yet

Leave a comment »

  1. Pingback from
    1
    Google AJAX Libraries API WordPress Plugin » D' Technology Weblog: Technology, Blogging, Tips, Tricks, Computer, Hardware, Software, Tutorials, Internet, Web, Gadgets, Fashion, LifeStyle, Entertainment, News and more by Deepak Gupta. says:May 31st, 2008 at 2:43 am

    [...] May 31, 20082:43 am Google AJAX Libraries API WordPress Plugin The Google Ajax Libraries API WordPress plugin make it easy to use the Google hosted libraries without the need to mess with [...]

Leave a Response

Comment Preview
« Microsoft’s MoDist Tool: Designed to handle distributed systemsGoogle Street View Cars spotted in Spain »
Feed Icon

Subscribe via RSS or email: