In mockjax you can use a function to return a different response according to the request data type, like so:
$.mockjax(function(settings) {
if ( settings.dataType == 'json' ) {
return {
dataType: 'json',
proxy: 'test.json'
};
}
return false;
});
Is there a way to do the same thing according to the data sent via the request? This is the only way I can find so far:
$.mockjax({
url: '/',
data: { variable: 0 },
proxy: 'test.json'
});
What I want to do is change the proxy to a different file if variable > 0
.
So for example is there a way to parse:
data: { variable: <0 }
or similar?