How do I use the AjaxPrefilter?
1 answer
Read the documentation at http://api.jquery.com/jquery.ajaxprefilter/ , this function is mainly used to modify the data sent to your server before it was sent.
As an example, I specifically used
$.ajaxPrefilter(function (options, originalOptions, jqXHR) {
options.data = $.param($.extend(originalOptions.data||{}, {
timeStamp: new Date().getTime()
}));
});
Which takes the original data that should have been sent by adding another parameter with a time stamp. This was useful for solving the iOS issue of caching mail requests without having to add a timestamp to every single request.
+2
source to share