Guest User

Untitled

a guest
Aug 17th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. Can calling a complex function inhibit $.when?
  2. function someFunction(params) {
  3. //Creates an object
  4. //$.each(collection, funct() { /*do work on collection, essentially pushes items into an array */});
  5.  
  6. //JSON.stringify(results)
  7.  
  8. //$.ajax POST...this is what I want $.when to wait for
  9.  
  10. }
  11.  
  12. $.when(someFunction(params)
  13. ).then(doNextThing);
  14.  
  15. $.when(function() {someFunction(params) }
  16. ).then(doNextThing);
  17.  
  18. function someFunction(params) {
  19. ...
  20. return $.ajax(...);
  21. }
  22.  
  23. $.when(someFunction(params)).then(doNextThing);
Add Comment
Please, Sign In to add comment