I am trying to append extra parameters to query string for each ajax call
assuming the original url is: /customer/search?sort=Id, I want the processed url looks like
/customer/search?sort=Id&criteria=abc
this is the code
$.ajaxPrefilter(function (options, originalOptions, jqXHR) {
// Append the initial search criteria
options.url += '&criteria=abc';
});
the problem is: after one click, the url becomes: /customer/search?sort=Id&criteria=abc
after second click, the url becomes: /customer/search?sort=Id&criteria=abc&criteria=abc
it keeps adding up
It looks like jQuery ajax call is using the same options object, so I added a custom flag
$.ajaxPrefilter(function (options, originalOptions, jqXHR) {
// Append the initial search criteria
if (!options.processed) {
options.url += '&criteria=abc';
options.processed = true;
}
});
the problem is: options.processed is always undefined. looks like every ajax call is using a unique options object. now I am confused :)