Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Tim Sanders on Jun 26, 2009 15:15
open dhtmlx forum
Caching for AJAX calls

We had designed some pages to do AJAX calls to periodically update data shown in the pages. This was working on some browsers and not on others. We determined that in Internet Explorer there is a caching setting for "check for newer versions of stored pages" that needed to be set to "every time I visit the webpage". If this is set, the pages work OK.

Unfortunately these pages are designed to be used by customers so we can't control their browser settings. Is there anything we can do to make these calls work regardless of caching settings?

Thanks.
Answer posted by Support on Jun 29, 2009 01:50
You can randomize URL used for data fetching, for example if you need to call 
            some.php?param=value
You can use command as
            dhtmlxAjax.get("some.php?param=value"+"&uid="+(new Date()).valueOf())

As result, each time when command will be called, URL will have uid parameter with new value, and because url string is different each time - browser will request page from the server and not from the cache.