How to set cache false for getJSON in jQuery?

0 votes

I am using getJSON to fetch the results from server side but facing browser cache problems. I want the cache to be false. I tried using this just before my getJSON call.

 $.ajaxSetup({
                cache: false
            })

But I am not getting the expected results. It still shows the old results.

May 12 in JQuery by kartik
• 11,890 points
34 views

1 answer to this question.

0 votes

Hello @kartik,

Your code just needs a trigger for it to be enabled.

This will allow you to disable cache in all future ajax

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

Hope it helps!! 

Thank you!!

answered May 12 by Niroj
• 23,950 points

Related Questions In JQuery

0 votes
1 answer

How to check if button is disabled in jQuery Mobile?

Hello, you can try $("#deliveryNext").is(":disabled") The following code works for ...READ MORE

answered May 29 in JQuery by Niroj
• 23,950 points
25 views
0 votes
1 answer

How to prevent multiple selection in jQuery UI Selectable plugin?

Hii @kartik, What I did is that I allow multiple ...READ MORE

answered May 29 in JQuery by Niroj
• 23,950 points
27 views
0 votes
1 answer

How to import jQuery UI using ES6/ES7 syntax?

Hii, Add a alias in webpack config: resolve: { ...READ MORE

answered Apr 28 in JQuery by Niroj
• 23,950 points
71 views
0 votes
1 answer

How to convert form data to JavaScript object with jQuery?

Hello @kartik, You can use: function form_to_json (selector) { ...READ MORE

answered Apr 28 in JQuery by Niroj
• 23,950 points
39 views
0 votes
1 answer

Uncaught Error: Bootstrap's JavaScript requires jQuery

Hello @kartik, You have provided wrong order for ...READ MORE

answered Apr 28 in JQuery by Niroj
• 23,950 points
211 views
0 votes
1 answer

How to make Bootstrap popover Appear/Disappear on hover instead of click?

Hello @kartik, Set the trigger option of the popover to hover instead ...READ MORE

answered May 12 in JQuery by Niroj
• 23,950 points
35 views
0 votes
1 answer

How to enable Bootstrap tooltip on disabled button?

Hii @kartik, You can wrap the disabled button ...READ MORE

answered May 12 in JQuery by Niroj
• 23,950 points
48 views
0 votes
1 answer

Error:jquery each loop return false not end the function

Hii @kartik, Returning from one function doesn't call as it's ...READ MORE

answered 4 days ago in JQuery by Niroj
• 23,950 points
20 views
+1 vote
1 answer

How to set cache false for getJSON in jQuery?

Hello @kartik, Your code just needs a trigger ...READ MORE

answered May 29 in JQuery by Niroj
• 23,950 points
18 views
0 votes
1 answer

How to pass parameters in GET requests with jQuery?

Hello, Here is the syntax using jQuery $.get $.get(url, data, ...READ MORE

answered Apr 28 in JQuery by Niroj
• 23,950 points
36 views