Skip to content Skip to sidebar Skip to footer

How Exactly Does Done() Work And How Can I Loop Executions Inside Done()?

$.ajax({ url: '/api/1.0/tweets.php?username=' + username }).done(function (data) { //For loop here to do something multiple times )}; I have this piece

Solution 1:

Welcome to the world of asynchronous Javascript! One piece of advice: instead of thinking in terms of data being returned from functions, think in terms of functions that are executed each time some piece of data is ready.

What you need is something that will call your callback each time a piece of data is available. A similar question was asked here, with several answers that you may find helpful.


Post a Comment for "How Exactly Does Done() Work And How Can I Loop Executions Inside Done()?"