Ben Barnett’s Blog

The blog of London website maker Ben Barnett

View on GitHub

Adding Selector Support to jQuery.get() to get page fragments

09 Mar 2011

Just wrote a little plugin whilst working on a project because I keep finding myself using this functionality and having to write a handler in my application code. This plugin can be dropped in, just like jQuery Animate Enhanced and weighs in at less than 1KB, and it will enable you to quickly grab a partial or fragment of the AJAX endpoint. Here's some dummy code:

There's not really much more I can say about this. Its unobtrusive, light weight and will simply hand over to the native jQuery.get() method if no selector is supplied.

Further Resources