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
I expected the header to be in the headers and not in the markup.
Here is my controller action excerpt:
... $template = $this->render('list.html.twig', array( 'data' => $data )); return new Response($template); ...
Why is this and how can i make this disappear?
The method render()
display headers.
You can use method renderView()
. This method don't display headers, just the generate html.
Hope it's helpful. :)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With