 <p><code>async: false</code> is bad idea because ajax isn't meant to be blocking. Without <code>async: false</code> you cannot stop the function from returning. A better solution would be using <code>Deferred</code> object. You code can be improved like this.</p> <pre><code>function processData(data) { return data; } function test() { // what is being returned here is a deferred object // see http://api.jquery.com/deferred.then/ return $.ajax().then(function (data) { return $.ajax().then(function (data) { return processData(data); }); }); } function main() { // you can't stop test from returning, but you can used the return Deferred object test().done(function (finalData) { // processData(data) in test will be available as `finalData` here }); } </code></pre>