Andrus Andrus - 1 year ago 161
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 ?

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

$.get('API/MyGet', params, function(data) {
  alert( JSON.stringify(data) );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download