Reputation: 11709
I was asked this in an interview :
What is the proper syntax to add an anti-cache code to all jQuery getJson calls throughout a given project (without adding it to each getJson call). He asked me one liner code for this?
I am not sure how we can do this in one line?
Upvotes: 1
Views: 251
Reputation: 758
You can use jQuery.ajaxSetup(options)
to set default options that affect all subsequent AJAX calls, so you can do something like:
$.ajaxSetup({'cache': false});
Upvotes: 2