authored by Wayne Witzel III

jQuery getJSON and IE cache

On August 13, 2009 In jquery Permalink
I am sure everyone else who lives in the world of jQuery knows this, so this is more here for my own future reference and avoiding and more wasting of time, but if you are going to us $.getJSON helper in jQuery, append a time stamp to it to prevent odd caching behavior in IE. See the example below. $.getJSON("/story/story_id.php?_="+(new Date().getTime()), function(json) { $('#next_story_id').html('S' + json.next_story_id); }); This might not be the best way to do it and really, this is good practice for all dynamic requests to avoid caching issues from the browser and the server. Chalk this up as a good learning experience that sucked 30 minutes of my life. I hate front end stuff.
Read and Post Comments
blog comments powered by Disqus