Ticket #297 (assigned enhancement)
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 += '×tamp=' + 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
Note: See
TracTickets for help on using
tickets.