One way to deal with this is to make sure each request has a unique member. For example, if you are using a GET, you can add a p
parameter to hold a randomly generated value:
(Assuming we have a method named statChanged to handle the Ajax callback)
Code:
var xmlHttp
var url="MyAjaxHandler.php?r=" + Math.random() + "&search=" + document.getElementById("txtSearch").value
xmlHttp=GetXmlHttpObject(stateChanged)
xmlHttp.open("GET", url, true)
The url variable now includes a parameter named "r" that will hold a random value. This makes each request unique, thereby averting the caching problem. The "r" parameter isn't used in the code handling this call - its only purpose is to make the request unique.
Make sense?
Woody Z
http://www.learntoprogramnow.com