Archive image

Archive for May, 2013

Programmatically triggering events in jQuery

Recently, I made a tab-based menu system which loaded various content via AJAX whenever a user clicked on any of the tabs.

The only problem with this was, that when my page loaded the widget remained empty until the user had actually clicked something.

This left me wondering how best to simulate user interaction and initialize the widget programmatically.
Read more…

Promises with jQuery

Promises are starting to change the way we write asynchronous JavaScript. They allow us to write clearer, shorter callbacks and to separate application logic from DOM interaction.

jQuery’s implementation of the Promise pattern (introduced in version 1.5) centres around the Deferred object , the predominate use of which is to attach success and failure callbacks to AJAX requests.

Read more…