Manaus Posted April 17, 2014 Share Posted April 17, 2014 Hello, I have a page which is loading three times the same page, with different parameters. This is the code for the called page if ($config->ajax) { header("Cache-control: no-store, no-cache, must-revalidate, max-age=0"); header("Cache-control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); } if ($input->post->proj) { $progettocercato = (int) $input->post->proj; $progettocercato = $pages->get($progettocercato)->child("title=Comunicazioni")->children("utenti=$user"); // foreach .... // print records etc For three calls I get 5, 12, 15 seconds of response time (screenshot) on localhost The page is called through an $.ajax function. Is it standard ajax behaviour, or am I doing something unnecessary? Thanks! Link to comment Share on other sites More sharing options...
clsource Posted April 19, 2014 Share Posted April 19, 2014 I wonder why you put the headers in there.and the response time may vary depending of the children in the project. try using a limit 1 Link to comment Share on other sites More sharing options...
teppo Posted April 19, 2014 Share Posted April 19, 2014 Is it standard ajax behaviour, or am I doing something unnecessary? What @clsource said. This definitely isn't typical AJAX behaviour. Something you're doing is very resource intensive; most likely retrieving or rendering pages -- though that's also all we know about your use case, so there could be something else involved we just don't know about. Agreed about the headers, too: by default POST requests are not cacheable, unless specifically forced using Cache-Control and Expires headers. You don't need to define any of those headers here unless you're somehow forcing caching for POST requests (although if you're just fetching records, not altering them, I'm equally confused about the use of POST here in the first place). 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now