phpBMS

Ticket #297 (assigned enhancement)

Opened 3 years ago

Last modified 2 years ago

ajax call caching problem

Reported by: matt@… Owned by: brieb
Priority: minor Milestone: 1.0
Component: phpbms Version: 0.96
Keywords: needsReview Cc:

Description

I am having some issues with browsers caching the responses to ajax calls in phpBMS. When data (such as a price) changes, it takes some time for the cached url to expire and browsers to request new data.

My solution was to append this to the end of the ajax urls in, for example, invoices.js:

var today = new Date();
var timestamp = today.getTime();
theURL += '&timestamp=' + timestamp;

Alternatively, in cases where ajax calls are frequent enough to make caching valuable, the following will refresh on a daily basis:

var today = new Date();
var datestamp = dateToString(today);
theURL += '&datestamp=' + datestamp;

Or, hourly:

var today = new Date();
var datestamp = dateToString(today) + today.getHours();
theURL += '&datestamp=' + datestamp;

Thanks,

Change History

Changed 2 years ago by brieb

  • status changed from new to assigned

Changed 2 years ago by brieb

  • milestone changed from unknown to 1.0

Changed 2 years ago by brieb

  • keywords needsReview added

Can we get a confirmation on whether this is standard for most browsers or not? I was under the impression that by default httpRequests sent by JavaScript? are not cached.

Could this be a server caching problem?

Note: See TracTickets for help on using tickets.
Scanned by Orvant Copyright © 2010 Kreotek, LLC. All Rights reserved.