Bia Securities

Ajax: GET requests are cached but not POST reqeusts

by on Oct.31, 2005, under Uncategorized

I recently came across an issue with IE
caching responses from ajax requests.  My ajax code would send an
HTTP GET request if the querystring was less than 2067 characters and a
HTTP POST if the query data was larger.  When IE caching was set
to Check for newer versions of stored pages:
automatically, IE would cache the GET web response.  Changing the
ajax code so that it always performed HTTP POST requests fixed the
weird issues I was seeing (related to requests being cached). 

IE properly caches GET requests but doesn’t cache POST requests. 
So, I could have either altered the url of the GET request to be unique
everytime or I could have set the “Expires” header to -1.  I chose
to just use POST requests since I don’t want them to be cached
anyway.  More information can be found on the wikipedia page.

Anyway, hopefully this will help someone that runs into the same situation. 


Comments are closed.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!