0

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

}

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.