Andrus Andrus - 10 months ago 50
Ajax Question

how to pass json in query string parameter with jquery $.get

Jquery $.get should send single query string parameter _filters whose value is json string:


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:


How to force jquery get to pass proper query string ?

var params = {
  sort: '...',
  _filters: JSON.stringify({
    'key': 'value'

$.get('API/MyGet', params, function(data) {
  alert( JSON.stringify(data) );