javascript - xmlHttpResponse object not returning proper responseText in IE7 -


in application inorder avoid duplicate group names im trying validate user entered value through ajax call. im not receiving expected responsetext im receiving responsetext cache. js file: try{ if (window.activexobject) //ie var xhr = new activexobject("microsoft.xmlhttp"); else if (window.xmlhttprequest) //other var xhr = new xmlhttprequest(); else alert("your browser not support ajax"); }catch(e){alert("error in creting xmlhttpresponse: "+e);}

    escname= document.forms(0).txtescalationname.value;     escid = document.forms(0).hidgroupid.value;      urlparam = "escname=" +escname +"&esccode=" +escid;     alert(".."+urlparam);            xhr.open("get", "/myapp/jsp/main/escalationnamecheck.jsp?"+urlparam+"&ran="+math.random() ,true);  xhr.setrequestheader("cache-control","no-cache");  xhr.setrequestheader("pragma","no-cache");  xhr.onreadystatechange = function() {      if (xhr.readystate == 4)     {                        if (xhr.status == 200)         {                if (xhr.responsetext != null)              {                 alert(document.getelementbyid("escalationnamevalidate"));                  try{                 var populate = document.getelementbyid("escalationnamevalidate");                  populate.innerhtml = xhr.responsetext;                 }catch(e){                  alert("error!...."+e);             }             }             else             {                 alert("failed receive jsp file server - file not found.");                 return false;             }          }         else             alert("error code " + xhr.status + " received: " + xhr.statustext);     } else     alert("not ready"); }  xhr.send(null);  

after referring here: responsetext - xmlhttprequest have tried mentioning event below gave exception saying target null or not object. xhr.onreadystatechange = function(event) { var xhr = event.target; if (xhr.readystate == 4) { alert("first if");
if (xhr.status == 200) {alert("second if");
if (xhr.responsetext != null) {alert("third if"+xhr.responsetext);

            alert(document.getelementbyid("escalationnamevalidate"));                  try{                 var populate = document.getelementbyid("escalationnamevalidate");                 alert("11");                 alert("pop.."+populate.innerhtml);                 populate.innerhtml = xhr.responsetext;                 }catch(e){                  alert("error!.xhr..."+e);             }             }             else             {                 alert("failed receive jsp file server - file not found.");                 return false;             }             alert("escnameduplicate"+document.getelementbyid("escnameduplicate"));         }         else             alert("error code " + xhr.status + " received: " + xhr.statustext);     } else     alert("not ready"); }  

so tried 1. giving cache-control no-cache in requestheader 2. making xhr local variable using var xhr while defining it. 3. pointed event-instance in onreadystatechange function also. browser version: ie7

kindly assist. regards, nidhya

share|improve question
up vote 0 down vote accepted

i got done, modifying few options in ie settings. though close browser , open ie again, response getting cached in browser. so, did was, go tools --> internet options select setting under browser history select "every time visit webpage" under "check newer versions of stored pages:" save settings.

hope else myself.

share|improve answer

your answer

 
discard

posting answer, agree privacy policy , terms of service.

not answer you're looking for? browse other questions tagged or ask own question.

Comments