D3.json setup cache to false

I noticed that redrawing D3 elements with its json call (d3.json) don’t want to be updated on IE9+. The reason for it is that json calls gets cached so the browser doesn’t register as new data has been passed. Workaround for normal jQuery ajax calls is to set its property to cache: false, globally for all ajax calls:

$.ajaxSetup({ cache: false });

But how can I add it to d3.json calls, since its using own method for calling ajax? I succeeded with adding current timestamp after path:

var noCache = new Date().getTime();
d3.json(data + "?_=" + noCache)

but that is a bit lame way to do it… any suggestions how can I accomplish this? Or even better, how to setup this only if IE is running 🙂

85 thoughts on “D3.json setup cache to false”

Leave a Comment