To view this screencast, add it to
your cart
and
checkout.
You can buy this screencast for any price, including FREE!
A few years back, I watched the Peepcode episode Ajax with Prototype.js. I thought it was the coolest thing ever!
Compared to having to deal directly with XMLHttpRequest objects, it was so easy. But that was way back in 2007.
Now, jQuery is where it’s at. And doing AJAX with jQuery is even easier! Trivial, even!
In this episode, I’ll show you how to:
- make arbitrary GET/POST/PUT/etc requests to your server and get the response
- easily refresh part of the page with HTML rendered by your server
- get JSON data from local and remote servers (we demo getting tweets from Twitter)
- get and run remote JavaScript
- make sure your jQuery event handlers effect newly created DOM elements (eg. added via AJAX)
- and more
:)
1 $.post('/dogs', { 'dog[name]': 'Rover' }); 2 3 // you can actually try the following snippets right here, on the blog! just open Firebug :) 4 5 $.get('/index.html', function(html){ alert('got html: ' + html); }); 6 7 $('#content').load('/index.html #header'); 8 9 $.getJSON('http://search.twitter.com/search.json?q=remitaylor&callback=?', 10 function(tweets){ console.log(tweets.results) }); 11 12 $('a').live('click', function(){ alert("I get bound to new DOM elements"); return false; });