Can you please explain to me the simplest way on how the AJAX prefiltering in jQuery works? Sorry I'm a newbie in using AJAX.
Is it for customizing requests in the server? Thanks.
I'm referring to this site but still can't get it.
Can you please explain to me the simplest way on how the AJAX prefiltering in jQuery works? Sorry I'm a newbie in using AJAX.
Is it for customizing requests in the server? Thanks.
I'm referring to this site but still can't get it.
Have a read of the documentation at http://api.jquery.com/jquery.ajaxprefilter/ this function is basically used to alter the data that is sent through to your server before it is sent.
An example I have used specifically is
$.ajaxPrefilter(function (options, originalOptions, jqXHR) {
options.data = $.param($.extend(originalOptions.data||{}, {
timeStamp: new Date().getTime()
}));
});
Which takes the original data that was to be sent through an adds another parameter with a timestamp. This was useful to get around iOS's problem with caching post requests without having to add a timestamp to each individual request.