Так?
Codepen$('body').text('Loading...');
makeAjax(function(data) {
$('body').html(function() {
var result = '';
for (var user in data) {
result += '<div>'+ data[user].name + ' (' + data[user].email +')</div>';
}
return result;
}());
});
function makeAjax(done) {
return $.ajax({
url: 'https://jsonplaceholder.typicode.com/users',
method: 'GET',
dataType: 'json',
success: function(data) {
setTimeout(function() {
if (done) done(data);
}, function(min, max) {
return Math.random() * (max - min) + min
}(2e3, 3e3));
}
});
}