Aviel Fedida
Aviel Fedida

Reputation: 4102

JQuery.ajax(), cache option IE8

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.

Upvotes: 3

Views: 604

Answers (1)

richaux
richaux

Reputation: 2672

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"
});

Upvotes: 5

Related Questions