Skip to content

Instantly share code, notes, and snippets.

@maiis
Created October 2, 2013 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maiis/6794452 to your computer and use it in GitHub Desktop.
Save maiis/6794452 to your computer and use it in GitHub Desktop.
// save old function
$.ajaxOld = $.ajax;
// replace ajax call with our own that adds the delay
$.ajax = function() {
// save state from the original function call for use later
var args = [].slice.call(arguments);
var self = this;
// call the original ajax function in 1.5 seconds
setTimeout(function() {
$.ajaxOld.apply(self, args);
}, 1500);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment