2

I have the following :

$.ajax({
  type: "post",
  url: "something.cfm",
  data: formData,
  cache: false,
  success: function (result) {
    $("#formSub").html(
      '<input type="button" name="btnSave" id="btnSave" class="submitButton save" value="Save" disabled="disabled"/>'
    );
  },
  error: function (xmlHttpRequest, status, err) {
    confirm("Error!" + err);
  },
});

On IE8 or IE7, sometimes the success function does not run and the disabled btnSave does not appear. So, people keep submitting the same form over and While working on another application, I found out that the cache:false does not seem to work.

Woohaik
  • 1,084
  • 1
  • 6
  • 24
CFNinja
  • 3,571
  • 4
  • 38
  • 59
  • `cache` Default: true, false for dataType 'script' and 'jsonp' If set to false it will force the pages that you request to not be cached by the browser. ::: how do you know that the result is being cached? Could it POSSIBLY be anything else? – jcolebrand Nov 10 '10 at 19:41
  • 1
    Have you try looking for the 'complete' event handler? – Stefan Kendall Nov 10 '10 at 20:25
  • 1
    Looking at jQuery's source, the cache parameter is only honored if you're doing a GET request, not a post. It doesn't really make sense at all for a POST request to get cached. That sounds like something that even Microsoft wouldn't mess up. – Mike Ruhlin Nov 10 '10 at 23:47
  • You can also check [this](http://stackoverflow.com/a/16418592/1027017) answer – Vishal May 07 '13 at 12:07
  • You can always try a "dirty" solution and add a random string to end of the URL. You can also try chaining an **always** function to the end of your ajax call https://api.jquery.com/jquery.ajax/ – imvain2 May 26 '23 at 21:13

0 Answers0