Faking AJAX

I recently had a client who wanted to have their recent posts show up in a visitor's sidebar as they were posted. Which is to say as soon as a writer published a new post, a link would show up in the sidebar. Now, normally I'd do this using websockets and send out a quick little message whenever something is posted. Unfortunately websockets-based libraries and related techniques was out of the question. So was frequent polling of the server over AJAX due to hosting constraints and high traffic levels.

Live example of the plugin expanding in an element.

Lacking this critical connective ability, I thought to myself, what if the posts could be "live-published" to the browser in a way that made it look like they were but in reality they had already been published. Going with this notion, I created a jQuery plugin that emulates live publishing and is very configurable.

The jQuery Fake Live Loading plugin takes a parent selector and, optionally, an options object that dictates things like delays, child selectors and before/after callbacks. It's available under a Creative Commons Attribution Share-Alike License. You can grab a copy of the code or check out the full list of options from the repository on Github.

If you like this plugin and/or would like to see more like it, consider leaving a tip via gittip. I spent a lot of time putting this and other free plugins together for you to use and I donate a third of the money to other developers that really need it so it's for a good cause :).