Guest User

Untitled

a guest
Jan 20th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. function myFunct(settings, callback){
  2. if(!callback)return;
  3. var x = 100;
  4. //here is where i have issues, as i want
  5. //to be able to adjust the success function
  6. // to also have 1 line of code, a decrementer.
  7. //I want to do something like settings.success = "x--;" + settings.success;
  8.  
  9. callback(settings);
  10.  
  11. //I also wasnt sure if you could wrap 'callback'
  12. //with a success function when the inner success function executes
  13. }
  14.  
  15. var settings = "";//settings of the ajax call.
  16. myFunct(settings, function(x){ $.ajax(x);});
  17.  
  18. function myFunct( settings, callback ) {
  19. if (!callback) return;
  20. var x = 100;
  21.  
  22. callback(settings).done(function(){
  23. x--;
  24. });
  25. }
  26. var settings = { url: "foobar.php" };
  27. myFunct( settings, function(x) {
  28. return $.ajax(x);
  29. })
Add Comment
Please, Sign In to add comment