As we all know Google has released some pretty nifty things in the past. Today, we’re going to look at one of its most delightful additions for web developers. Google AJAX API.
What is Google AJAX API?
That’s great, but what does that mean for me?
Bandwidth, bandwidth, bandwidth, cache headers, and bandwidth.
Google is lightning fast, always. To have one, maybe two less items to download from your server not only saves bandwidth, but it saves you time. You don’t have to go to jQuery and download the latest version, upload it to your server, and type in the path to the (.js) file. You also don’t have to worry about having relative or absolute URLs due because of pretty URLs (seo friendly URLs).
Enough already, just show me how
Glad you asked. Below is the example XHTML page used to load in jQuery and execute a test function to ensure that it works.
Now, we’ve loaded in jQuery and are able to get cracking away. However, what if we want to add more than one library? Simple. All we do is add another instance of google.load();. Below is an example with both jQuery and jQuery UI.
Want to use the latest version of jQuery so you never have to update the code to match the latest version? No problem use this instead.
What this says is: “Find the latest stable release that starts with 1.3.x”. In our case it automatically found v1.3.2.
This is also another way of calling jQuery from Google’s servers.
That’s it! Enjoy one less heavy server request.