javascript - Disjunction of filters in ajax, request to flask-restless -


i have backend application flask-restless replies json data. set. request these data javascript $.ajax function. works perfect 1 filter, need more filters, don't know how them set.

example 1 filter (it works):

    var page = 1;     var filters = [{"name": "device", "op": "eq", "val": 1}];             var url = 'http://..../results?page=' + page;              $.ajax({               url: url,               data: {"q": json.stringify({"filters": filters})},               datatype: "jsonp",               type: "get",               contenttype: "application/jsonp",               success: function(responsedata, textstatus, xmlhttprequest) {...}             }); 

for 2 filters tried (it doesn't work):

    var page = 1;     var filters = [{"name": "device", "op": "eq", "val": 1},{"name": "device", "op": "eq", "val": 2}];            var url = 'http://..../results?page=' + page;          $.ajax({               url: url,               data: {"q": json.stringify({"filters": filters},{"disjunction":true})},               datatype: "jsonp",               type: "get",               contenttype: "application/jsonp",               success: function(responsedata, textstatus, xmlhttprequest) {...}          }); 

has of ever had similar problem?

you need give json.stringify array convert string.

data: {"q": json.stringify([{"filters": filters},{"disjunction":true}])}, 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -