I am trying to use a JSON array created using JavaScript, but the array is never bound in my controller
Here is the JavaScript code that I use to call my action with the controller
$.post("/produits_ajax",{filterParams:[{name:"milk", value:"chevre"}, {name:"pate", value:"molle"}]}, function(data){ $('.dynamicContent').html(data); slideProducts();
Entrance to my route
POST /produits_ajax Application.produitsAjax
This is how I get it in my game! controller. I am using play 1.1 and JsonArray is from com.google.gson.JsonArray
public static void produitsAjax(JsonArray filterParams) { if(filterParams != null) Logger.debug("Le Json: " + filterParams.toString()); else Logger.debug("filterParams is null"); render(); }
As you can imagine, I always get "filterParams is null" in my console (I wouldn’t feed it if I hadn’t)
It is very simple so far I just want to associate the array generated in JS with my JsonArray. Play! The Framework has excellent documentation, but for some reason there is very little on this.
If anyone can shed light on this, it would be very appreciated
source share