Archive

Archive for July 1st, 2009

jQuery GET caching and you…

July 1st, 2009

I was working with jQuery today and I had an unusual issue.  Some users were getting incorrect data when using the app and others had no problem at all.  After checking the code and the queries I started looking at the app using Firebug, the best plugin ever.  After a few minutes of trial and error, I was still stumped.  I could not understand why only a few people were getting wild results.  Well, the final straw was when we changed the caching rules in the browser to automatically reload data and never load new versions of the page.  That was when I finally was able to reproduce the problem.

It turns out that ajax calls will cache your requests unless you append a different value at the end of each request.  You can also stop the cahcing if you use the jQuery post method instead of the get method.  I had no idea that ajax did that, but thanks to Ken Foubert’s blog post for clearing that up.

Lu Sancea AJAX