Skip to content

Instantly share code, notes, and snippets.

@christophergregory
Created April 16, 2013 18:33
Show Gist options
  • Save christophergregory/5398359 to your computer and use it in GitHub Desktop.
Save christophergregory/5398359 to your computer and use it in GitHub Desktop.
Keep IE from caching ajax call
function getCart(callback) {
var rnum = Math.floor((Math.random()*1000000000)+1),
rand_url = '/cart.js?' + rnum;
jQuery.getJSON(rand_url, function (cart, textStatus) {
if ((typeof callback) === 'function') {
callback(cart);
}
else {
Shopify.onCartUpdate(cart);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment