i have this Action
public function testAction($array){
/**
* @var $array \Doctrine\Common\Collections\Collection
*/
return array(
'array_like' => $array->slice(0,5),
);
}
that i render in my twig with
{{ render(controller("SNWallBundle:Wall:test" ,{ 'array': obj.spotted.spottedLike} )) }}
then i want to call testAction for slice to 5,10
with ajax call like
$.ajax({
type: "POST",
url: Routing.generate('test',{array:ARRAY COLLECTION !}),
dataType: "json",
beforeSend: function() {
},
success: function(msg) {
console.log("OK");
},
error: function(msg) {
},
complete :function( msg ) {
}
});
How can i do it? i have to use JMS Serializer?