Jump to content

ajax load times


Manaus
 Share

Recommended Posts

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

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).

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...