سؤال

Hello everyone I was trying to understand this sentence (from JQuery.ajax()) about cache option:

except in IE8 when a POST is made to a URL that has already been requested by a GET.

If anyone can help me with some simple example and explanation I will be very thankful, Thank you all and have a nice day.

هل كانت مفيدة؟

المحلول

From @Kevin B's comment "If you make a GET request in IE8 and then later make a POST request to the same URL, IE8 will incorrectly return the cached response rather than doing the POST."

$.ajax({
  type: "GET",
  url: "test1.htm"
});

/* In IE8 this comes from the cache */
$.ajax({
  type: "POST",
  url: "test1.htm"
});

$.ajax({
  type: "GET",
  url: "test2.htm",
  cache: false // adds a timestamp to the querystring
});

/* Even IE8 avoids the cache */
$.ajax({
  type: "POST",
  url: "test2.htm"
});
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top