Guest User

Untitled

a guest
Jan 20th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. function sample (context, data)
  2. {
  3. var deferred = $.Deferred();
  4. $.ajax({ success: function (newData) {
  5. deferred.resolveWith(context, newData);
  6. }});
  7.  
  8. return deferred;
  9. }
  10.  
  11.  
  12. sample(this, data)
  13. .done(function(newData)
  14. {
  15.  
  16. console.log(this, 'is in samecontext as this passed');
  17. });
Add Comment
Please, Sign In to add comment