Topic: One problem with caching of web pages

I have a problem with the cache of my site ...
It turns out that in the example PROGRES BAR, I have almost resolved thanks to ED, but now I have the problem with the cache I guess,
Which you can also click on the button a second time GO, and the subsequent times.
which shows the "progress bar" full, without the event's progress.
That is what first |==... |==== then ... and finally |======|, but no such event after the first click on GO.

Code: PHP

<?php

header ("Cache-Control: no-cache, must-revalidate"); //no guardar en CACHE

header ("Pragma: no-cache");

/*

    Simple XAJAX Progress bar example...

*/



require_once("xajax/xajax_core/xajax.inc.php");

$xajax = new xajax();

$xajax->configure('javascript URI', 'xajax/');        



function test($dta='')

{

    $resp=new xajaxResponse();

    sleep(3);    

    return $resp;

}





$xajax->register(XAJAX_FUNCTION,"test");

$xajax->processRequest();

?>



<html>

<head>

<title>Progress Bar</title>

<style>

/* SINGLE PROGRESS BAR */

.progressBar{

    width:216px;

    height:41px;

    background:url(bg_bar.gif) no-repeat 0 0;

    position:relative;

}

.progressBar span{

    position:absolute;

    display:block;

    width:200px;

    height:25px;

    background:url(bar.gif) no-repeat 0 0;

    top:8px;

    left:8px;

    overflow:hidden;

    /*text-indent:-8000px;*/

}

.progressBar em{

    position:absolute;

    display:block;

    width:200px;

    height:35px;

    background:url(bg_cover.gif) repeat-x 0 0;

    top:5px;

}



</style>

<?php $xajax->printJavascript(); ?>

<script>



xajax.callback.global.onRequest = function() {xajax.$('loading').style.display='block';}

xajax.callback.global.beforeResponseProcessing = function() {xajax.$('loading').style.display='none';}

</script>

</head>

<body>

<div id="loading" style="display:none; position: absolute; top:200; left: 400;">

    <p class="progressBar">

        <span><em >Processing...</em></span>

    </p>

</div>

<input type="button" value="Go" onclick="xajax_test()"/>

</body>

</html>

I put the startup code to clear the cache but it did not work, what can we do? any idea?

Last edited by luismarcelo (2009-07-16 7:24:51 PM)

Re: One problem with caching of web pages

Hi!
I met the same problem. Could you please tell me - did you find solution?

Re: One problem with caching of web pages

Hi Luis,

Haven't heard from you in a while...

I think the problem is not caching but the fact that every time the "Go" button is clicked the global onRequest function is called.

Perhaps you could do a bit of JS client side that disables to "Go" button and calls the xajax_test() function. Then, inside of test() you cound do a response->script that reenables the button. This way the button cannot be clicked while the server side processing is going on.

Ed

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.