Hi,
I have a problem with browser caching. I request some json formatted data that is relatively static, so I created a handler that returns the page with an ETag that contains a hash of the dataset. When I refresh this call in the browser and the data is unchanged, just the ETag is returned with status code 304: not modified.
However, when I call this with Ext.Ajax, I alwas get a new call to the database:
Ext.Ajax.request({
url: 'PF.spIIMGetNews.pf?render=json',
callback: function(options, success, response){
var objResults = Ext.util.JSON.decode(response.responseText);
window.alert('test:'+ objResults.rows[0].Date );
}
}); //Ext.Ajax.request
I tried to use a HttpProxy, but this also results in a request to the database.
I have a second question related to this. My caching works fine when I use a function CacheController.getURL (this comes from C. Gross book Ajax Patterns and Best Practices, Apress). It does correctly return me a json set and respects caching:
CacheController.getURL( 'PF.spIIMGetNews.pf?render=json', myComplete);
function myComplete( status, statusText, responseText, responseXML) {
var objResults = Ext.util.JSON.decode(responseText);
window.alert(objResults.rows[0].Date); // test json set
}
What I do not know is how I can load this json set to my jsonreader or store. I tried to use load and loadData but was not successful as yet. However, the data is there.
Has anybody a brilliant idea?
Thanks & have a nice weekend,
Jan
Thanks Condor, you solved my problem.
Jan
Use method: 'GET' and disableCaching:true.
I Am a Sinner – What About You?
Global Sourcing and Supplier Online by Dylan
|