Advertisement
arxeiss

jQuery AJAX and Deferred

May 19th, 2016
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var get1 = $.get(url1);
  2. var get2 = $.get(url2);
  3. $.when(getDetail, getExecutions).then(function(first, second) {
  4.     // Success of get1 and get2
  5.     // Do another request, based on the previous
  6.     return $.get(first.LoadUrl);
  7. }, function(error){
  8.     // Error of get1 or get2
  9. }).then(function (third) {
  10.     // Success of 3rd reqest created in first success function
  11. }, function (error) {
  12.     // Error of 3rd request created in first success function
  13. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement