I want my function to process the results, then call itself from the done
callback.
function geocode(id) {
console.log(id + ' geocode');
$.ajax({
url: '/customers/' + id + '/geocode',
dataType: 'json',
data: {
id: id,
}
}).done(function() {
var newID = id++;
console.log(id + ' done.');
geocode(newID);
});
}
This isn't incrementing though, say if I start it at 1, it just loops on 2 forever. I know it's a pain returning data from ajax, but I've never fully got my head round the nuances