Hi friends,
i have a problem in ajax.The code will get values when i use IE but it doesnt work with mozilla browser.It showing the alert message ? I am adding the code along with this.Expecting the reply soon.
var xmlHttp;
function getXmlHttp()
{
try {
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
try {
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
try {
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
alert("Please use a new browser!");
return false;
}
}
}
}
function user()
{
document.getElementById('form').style.visibility = "visible";
var id=document.getElementById('id').value;
getXmlHttp();
var myurl = "<%=request.getContextPath()%>/AjaxUser.do?type=ajax&id="+id;
xmlHttp.open("GET", myurl , true);
xmlHttp.onreadystatechange = useHttpResponseSuggestId;
xmlHttp.send(null);
}
function useHttpResponseSuggestId()
{
if (xmlHttp.readyState == 4)
{
if(xmlHttp.status == 200)
{
var textout = xmlHttp.responseText;
try
{
var x= new DOMParser().parseFromString(textout, 'text/xml');
xmldom.async="false";
xmldom.loadXML(x);
alert(xmldom);
xmlObj=xmldom.documentElement;
var master = [document.getElementById('name'),document.getElementById('password'),
document.getElementById('realname'),document.getElementById('email'),
document.getElementById('title'),document.getElementById('desc')];
var length=xmlObj.childNodes.length;
for(var i=0;i<master.length;i++)
{
master[i].value = xmlObj.childNodes[i].firstChild.nodeValue;
}
}
catch(e)
{
try
{
var xmldom = new ActiveXObject('Microsoft.XMLDOM');
xmldom.async="false";
xmldom.loadXML(textout);
xmlObj=xmldom.documentElement;
var master = [document.getElementById('name'),document.getElementById('password'),
document.getElementById('realname'),document.getElementById('email'),
document.getElementById('title'),document.getElementById('desc')];
var length=xmlObj.childNodes.length;
for(var i=0;i<master.length;i++)
{
master[i].value = xmlObj.childNodes[i].firstChild.nodeValue;
}
}
catch(e)
{
alert("Please use a new browser! This browser does not support XML!");
}
}
}
}
}
i am getting this alert("Please use a new browser!");
while using mozilla....