promises promises
by alexbfree
JavaScript
x = $.ajax({
url: 'http://experiments.zooniverse.org/experiment/SerengetiAwarenessExperiment1?userid=123125',
dataType: 'json'
}).promise().done(
function(data, textStatus, jqXHR) {
console.log('done:' + data.cohort);
}).fail(function(jqXHR, textStatus, errorThrown) {
console.log('failed');
});
x.done(function() {
console.log('done');
});
x.then(function() {
console.log('then2');
});
x.then(function() {
console.log('then3');
});
x.always(function() {
console.log('always');
});