I have a form with checkboxes, with their 'checked' value being populated from code behind in a database.
Imagine, if I have checkboxes 1,2 and 3 all set to checked in the database. I load the page, uncheck checkbox 3 and then commit the changes to the database. Now in my database, checkboxes 1 and 2 are checked and 3 is unchecked. I refresh the page, it gets the updated database values and the checkboxes have the correct checked values.
This is only working for me in chrome and FF. In IE, even if I uncheck checkbox 3, commit the changes to the database and refresh, it still appears checked. I forced a refresh with ctrl+f5 and it still isn't updating. Adding autocomplete="off" to both the checkboxes and parent form did nothing.
One point worth mentioning is that many browser will ignore autocomplete settings for login fields (username and password). As the Mozilla article states: For this reason, many modern browsers do not support autocomplete="off" for login fields.
To disable the autocomplete of text in forms, use the autocomplete attribute of <input> and <form> elements. You'll need the "off" value of this attribute.
This question is already answered in comments but no relevant answer is provided in Answers. I am trying to answer it here so that it will be useful for all others users facing same issue.
The solution can be :
Consecutive ajax call with no change in request are often considered as cached by some browsers and this issue is particularly reproducible in IE 10
. The response for request is HTTP 304 Not Modified
and request doesn't hit the database. The solution is to use ajaxSetup
to set cache
to false
like :
$(document).ready(function() {
$.ajaxSetup({ cache: false });
});
NOTE: This will set cache false for all ajax calls in the session.
OR
Using cache: false
in particular ajax calls, if you don't want to disable cache for all ajax calls.
$.ajax({
...
cache: false,
...
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With