Even though we're pretty busy at the office, I managed to slip out and attend the last PADNUG meeting and catch up with some friends. This time was the return of a PADNUG regular, Rick Strahl. If it sounds like we're spoiled with outstanding speakers, it's because it's true. Rick, fresh from a vacation in Switzerland, put on a right good show.
His presentation covered jQuery in an ASP.Net context. jQuery is a popular JavaScript library that helps do a lot of cool things with very little code. One of the latest examples here at Pop Art, Inc is the Leatherman Argentum microsite. This has quite a few interactive components and I couldn't imaging writing all that JavaScript from scratch.
One of the best plugs I've heard for jQuery is that it makes programming the browser fun again. All too often, we get bogged down in the woes of browser compatibility. It works in one browser but not another. jQuery makes all of this go away because they've taken on the challenges of browser compatibility and I'm able to write code against their library and worry much less about the quirks of Firefox, Internet Explorer, Safari and others.
Here are a few links to help you get started with jQuery:
For a jQuery example, I'll lean on an old friend of mine. I'm a bit of a web service aficionado, having survived old-school XMLHttpRequest (XHR) calls from the turn of the century, through early SOAP and now up to REST-based WCF services. Things like the following jQuery example really make me smile. This bit of code finds the <div> tag with the id of "#foo" and injects the HTML returned by a call to the given web service; all in a single line of JavaScript.
$('#foo').load('http://www.popart.com/blogposts.axd');
I don't need to create an instance of an XHR object, check which browser is being used or even catch the bits received by the call to the web service. It's all handled neatly by jQuery. If necessary, I could easily pass an assortment of parameters along for the ride in the previous code block, or even change it to an HTTP verb of PUT, DELETE or POST. jQuery just makes it so easy.
Scott Hanselman has recent podcast with the creator of the jQuery library, John Resig. Its really inspiring when I find out that people who make great constributions to the community are just normal people, like you and me — well, maybe you.