i'm trying to get object array from jquery. I have my function in deafault controller that return the query result using JsonResponse.
/**
* @Route("/{id}", name="result")
*/
public function getResult($id){
$em = $this->getDoctrine()->getManager();
$results = $em->getRepository("AppBundle:ExampleTable")->findAll();
return new JsonResponse($results);
}
In jquery when click on Search button I use the get function to call /{id} page.
$(document).ready(function(){
$("#search-button").click(function(){
var value = $("#text-set").val();
var i;
$.get("/"+value,function(data){
//
});
});
});
Now i don't know how to take this result from "data" and use it. I don't want reload the page just want that jquery set text of div with result that get back from getResult function.
Thanks.