new Promise(function(resolve){ $.getJSON('url', function(res){ resolve(res); }); }).then(function(res){ alert(JSON.stringify(res)); });