title: refresh data in view after ajax request symfony
body: <p>I'am new in Ajax and I intregated one ajax request. The purpose is one user can like, unlike an article. Look my code :</p>
  
  <p>controller</p>
  
  <pre><code>public function likeAction(Request $request, Article $article, $slug)
  {
      if (!$this-&gt;get('security.authorization_checker')-&gt;isGranted('IS_AUTHENTICATED_REMEMBERED')) {
          throw $this-&gt;createAccessDeniedException();
      }
  
      if ($request-&gt;isXmlHttpRequest()) {
          $tokenStorage = $this-&gt;get('security.token_storage');
          $currentUser = $tokenStorage-&gt;getToken()-&gt;getUser();
          $likes = $article-&gt;getLikes();
          foreach ($likes-&gt;getUsers() as $user) {
              if ($user == $currentUser) {
                  throw new \Exception('Vous aimez déjà cet article !');
              }
          }
          $likes-&gt;addUser($currentUser);
          $likes-&gt;setCount($likes-&gt;getCount() + 1);
          $em = $this-&gt;getDoctrine()-&gt;getManager();
          $em-&gt;persist($article);
          $em-&gt;flush();
  
          $count = $article-&gt;getLikes()-&gt;getCount();
          return new JsonResponse(array('data' =&gt; $count));
      }
      return $this-&gt;redirectToRoute('pm_platform_view', array('slug' =&gt; $slug));
  }
  </code></pre>
  
  <p>route</p>
  
  <pre><code>pm_platform_like:
      path:      /like/{slug}
      defaults:
          _controller: PMPlatformBundle:Article:like
  </code></pre>
  
  <p>view</p>
  
  <pre><code>&lt;a class="btn btn-blue-grey" id="like" role="button"&gt;&lt;/a&gt;
  &lt;span class="counter" id="counter"&gt;{{ article.likes.count }}&lt;/span&gt;
  
      &lt;script&gt;
          $( document ).ready(function() {
              $(document).on('click', '#like', function (e) {
                  $this = $(this);
                  $.ajax({
                      type: 'GET',
                      url: '{{ path('pm_platform_like', {slug: article.slug}) }}',
                      dataType: 'JSON',
                      data: {},
                      success: function() {
                        //refresh article.count here 
                      }
                  });
              });
          });
      &lt;/script&gt;
  </code></pre>
  
  <p>Currently the ajax request works and the "like" is persisted in database. But in my view nothing change, I have to "refresh" data, more precisly the like count attribute of article entity after the success of the ajax request. I need help for that.</p>