Symfony Ajax Response displays cache header

前端 未结 2 1083
难免孤独
难免孤独 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:27

    The method render() display headers.

    You can use method renderView(). This method don't display headers, just the generate html.

    Hope it's helpful. :)

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题