Skip to content

Instantly share code, notes, and snippets.

View colinjoy's full-sized avatar

Colin Joy colinjoy

View GitHub Profile
@colinjoy
colinjoy / q_example.js
Created April 11, 2016 06:35 — forked from jeffcogswell/q_example.js
Here's another chaining example on using q.js. This doesn't have any error handling, as I just want to demonstrate the chaining concept. Please read the comments carefully, as I start out with a non-q example, to show the order of flow. Please post comments if there's anything that isn't clear and I'll try to revise it as needed.
// Q sample by Jeff Cogswell
/*===========
We want to call these three functions in sequence, one after the other:
First we want to call one, which initiates an ajax call. Once that
ajax call is complete, we want to call two. Once two's ajax call is
complete, we want to call three.
BUT, we don't want to just call our three functions in sequence, as this quick