Reputation: 27921
Jquery $.get should send single query string parameter _filters whose value is json string:
API/MyGet?_filters='{groupOp:"AND",rules:[{field:"Toode",op:"eq",data:"xxxx"}]}'&sort=code
I tried
$.get( 'API/MyGet', {
_filters:{ groupOp:"AND",
rules:[{field:"Toode", op:"eq", data:'xxxx'}]
},
sort: 'code'
},
function(data) {
alert( JSON.stringify(data) );
}
);
but Chrome developer tools show that this creates incorrect and strange query string:
_filters[groupOp]=AND&_filters[rules][0][field]=Toode&_filters[rules][0][op]=eq&_filters[rules][0][data]=
How to force jquery get to pass proper query string ?
Upvotes: 2
Views: 3056
Reputation: 818
var params = {
sort: '...',
_filters: JSON.stringify({
'key': 'value'
})
};
$.get('API/MyGet', params, function(data) {
alert( JSON.stringify(data) );
});
Upvotes: 1