var promises = [];
...// pushing some elements to array
jQuery.when.apply(jQuery, promises).then(
// Success Callback
function ()
{
this.save().then( //save()-It is a function described below
function ()
{
...//some code
}
, function (error)
{...///code
}
));
}
// Error Callback
, function (error)
{
...// Code
}
);
);