Question : Ajax code showing problem in IE6 / Firefox

I m using following code to get  xmlHttpRequest object , bt its failing

var xmlHttp;
try
  {  // Firefox, Opera 8.0+, Safari  xmlHttp=new XMLHttpRequest();  }
catch (e)
  {  // Internet Explorer  try
    {    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    }
  catch (e)
    {    try
      {      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      }
    catch (e)
      {      alert("Your browser does not support AJAX!");      return false;      }    }  }  }



and also i tried with following code

var xmlhttp = false;

try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
      try {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
            xmlhttp = false;
      }
}
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
            xmlhttp = new XMLHttpRequest();
}


but everytime I m getting same alert "Your browser does not support AJAX!"

any solution  its urgent

Answer : Ajax code showing problem in IE6 / Firefox

I got , this error was coz of only  calling the servlet class

i was using


xmlHttp.open("GET","http://localhost:8080/deleteChk1?user="+str,true);

I removed  "http://localhost:8080/" and simply calling  deleteChk1 java class and its working

 

 

Random Solutions  
 
programming4us programming4us