Symfony Ajax Response displays cache header

symfony

Solution

The method `render()` display headers.

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

Hope it's helpful. :)

Problem

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?

Original source