Reputation: 71
I have the below way of framing ajax url which is caching the old ajax response on second call .how to get the latest response? Let mw know if you need details?
CODE :
var fullUri = target+ "?"+"ACTION="+action+"&"+"ARGS="+args+"&"+"EVENT_TYPE="+eventType+"&"+"MODE="+mode+"&"+"PARAMKEYS="+paramkeys+"&"+"PARAMVALS="+paramvals; **//Framing the URL**
xhr.open("GET", fullUri, false); **//Getting the response**
xhr.send(null);
}
Upvotes: 0
Views: 86
Reputation: 60105
You need to use a technique called cache busting. Something add this to your url:
xhr.open("GET", fullUri+'&rnd='+Math.random(), false);
This will make URL always unique and thus it will always be a cache miss.
Upvotes: 1