title: Session lost after AJAX request (Symfony 3)
body: <p>I have shopping cart where I'm adding items via AJAX (fetch). When I add item to cart and check request in debug toolbar, the session is correctly set. But after page reload, the session disappear. It it strange because when I use same code for adding item to cart but not via AJAX (using link and redirect), everything works fine. Where could be a problem?</p>
  
  <pre><code>public function addItem(int $id, string $type, int $quantity = 1)
  {
      $item = new CartItem();
      $item-&gt;setId($id);
      $item-&gt;setQuantity($quantity);
      $item-&gt;setType($type);
      $this-&gt;items[] = $item;
      $this-&gt;session-&gt;set(self::SHOPPING_CART_SESSION_NAME, $this-&gt;items);
  }
  
  
  /**
   * @Route("/add-to-cart", name="add_item_to_cart")
   */
  public function addItemToCart(Request $request)
  {
      $data = json_decode($request-&gt;getContent());
  
      $type = $data-&gt;type;
      $id = intval($data-&gt;id);
      $quantity = intval($data-&gt;quantity);
  
      $this-&gt;shoppingCartService-&gt;addItemToShoppingCart($id, $type, $quantity);
      return new JsonResponse('success', 200);
  }
  
  
  fetch('/add-to-cart', {
      method: 'post',
      body: JSON.stringify({
          type: type,
          id: productId,
          quantity: quantity
      })
  }).then((response) =&gt; {
      response.json().then(data =&gt; {
          console.log(data);
      });
  }).catch((error) =&gt; {
  });
  </code></pre>