Symfony Ajax Response displays cache header

前端 未结 2 1089
难免孤独
难免孤独 2021-02-05 02:15

In my ajax response the Cache-Control Header is displayed in the markup.

HTTP/1.0 200 OK Cache-Control: no-cache Date: Thu, 11 Oct 2012 09:00:59 GMT

2条回答
  •  难免孤独
    2021-02-05 02:41

    You can either do

    $template = $this->render('list.html.twig', array());
    return new Response($template->getContent());
    

    Or do this

    $template = $this->renderView('list.html.twig', array());
    return new Response($template);
    

    Second is more appropriate.

提交回复
热议问题