I have three HTTP calls that need I need to make in a synchronous manner and how do I pass data from one call to the other?
function first()
{
   ajax()
}
function second()
{
   ajax()
}
function third()
{
   ajax()
}
function main()
{
    first().then(second).then(third)
}
I tried to use the deferred for the two functions and I came up with a partial solution. Can I extend it to be for three functions?
function first() {
    var deferred = $.Deferred();
     $.ajax({
             "success": function (resp)
             {
                 deferred.resolve(resp);
             },
         });
    return deferred.promise();
}
function second(foo) {
     $.ajax({
            "success": function (resp)
            {
            },
            "error": function (resp)
            {
            }
        });
}
first().then(function(foo){second(foo)})
 
     
     
     
     
     
     
     
     
     
     
    