Difference between $.ajax(); and $.ajaxSetup();

The following will prevent all future AJAX requests from being cached, regardless of which jQuery method you use ($.get, $.ajax, etc.)

$(document).ready(function() {
  $.ajaxSetup({ cache: false });
});

you should use $.ajax, which will allow you to turn caching off for that instance:

$.ajax({url: "myurl", success: myCallback, cache: false});

Leave a Comment