title: using ajax in a symfony project to delete item
body: <p>hello I'm looking for a script that could allow me to delete item in a symfony project using ajax, I didn't find any solution for this I tried to delete an item  via id (I gave a static id) and then get the result without refreshing the page 
  here is my controller</p>
  
  <pre><code>$em = $this-&gt;getDoctrine()-&gt;getManager();
  $evenement = $em-&gt;getRepository("TunisiaMallBundle:Evenement")-&gt;find(39);
  $em-&gt;remove($evenement);
  $em-&gt;flush();
  $evenements = $em-&gt;getRepository("TunisiaMallBundle:Evenement")-&gt;findAll();
  $response = new Response();
  $response-&gt;headers-&gt;set('Content-Type', 'application/json');
  $response-&gt;setContent(json_encode($evenements));
  return $response;
  </code></pre>
  
  <p>I didn't know what I'm I supposed to return too.
  <a href="https://i.stack.imgur.com/TdvdG.png" rel="nofollow noreferrer">image</a></p>