User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 330,152 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,002 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 3222 | Replies: 24 | Solved
Reply
Join Date: Sep 2005
Posts: 557
Reputation: digital-ether will become famous soon enough digital-ether will become famous soon enough 
Rep Power: 5
Solved Threads: 33
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Posting Pro

Help Re: Problem with ajax and mozilla browser

  #11  
Jan 23rd, 2008
Originally Posted by sree22_happy View Post
Problem is when i run this code in IE it works fine.It takes the second try method in the index.jsp
When it comes to mozilla it throws an exception from the first try method as "Please use a new browser! This browser does not support XML!"

so can u help me please


Do you have firebug installed on Firefox?

Try viewing your XMLHttpRequest in Firebug and seeing if the response is well formatted.
What version of FF is it btw?

You can also tell if its well formatted or not by testing for the existence of xmlHttp.responseXML.

You should really be using xmlHttp.responseXML anyway, since any browser supporting XMLHttpRequest will support the responseXML property.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote  
Join Date: Mar 2006
Posts: 36
Reputation: sree22_happy is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
sree22_happy's Avatar
sree22_happy sree22_happy is offline Offline
Light Poster

Re: Problem with ajax and mozilla browser

  #12  
Jan 23rd, 2008
I am getting the response from firebug

<?xml version="1.0"?>

<code>

<name>sree</name>

</code>

but i didnt get the value
Reply With Quote  
Join Date: Mar 2006
Posts: 36
Reputation: sree22_happy is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
sree22_happy's Avatar
sree22_happy sree22_happy is offline Offline
Light Poster

Re: Problem with ajax and mozilla browser

  #13  
Jan 23rd, 2008
i am getting the textout value as above stated response.After that two try blocks are their.In IE the second try block is executing but in mozilla it enters in both the try block but returns exception ? what will be the reason for that
Reply With Quote  
Join Date: Mar 2006
Posts: 36
Reputation: sree22_happy is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
sree22_happy's Avatar
sree22_happy sree22_happy is offline Offline
Light Poster

Re: Problem with ajax and mozilla browser

  #14  
Jan 23rd, 2008
my firefox version is 2.0.0.3 !
Reply With Quote  
Join Date: Sep 2005
Posts: 557
Reputation: digital-ether will become famous soon enough digital-ether will become famous soon enough 
Rep Power: 5
Solved Threads: 33
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Posting Pro

Help Re: Problem with ajax and mozilla browser

  #15  
Jan 24th, 2008
Try removing the different DOM parsing functions and just have XMLHttpRequest return XML.

function ajax()
{
var name=document.getElementById('name').value;
getXmlHttp();
var myurl="<%=request.getContextPath()%>/AjaxController?type=ajax&name="+name;
alert(myurl);
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;
alert(textout);

var xmlObj = xmlHttp.responseXml.documentElement;

var master = document.getElementById('ajaxname');
master.value=xmlObj.childNodes[0].firstChild.nodeValue; 


}
}
}
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote  
Join Date: Mar 2006
Posts: 36
Reputation: sree22_happy is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
sree22_happy's Avatar
sree22_happy sree22_happy is offline Offline
Light Poster

Question Re: Problem with ajax and mozilla browser

  #16  
Jan 24th, 2008
function useHttpResponseSuggestId()
      { 
     if (xmlHttp.readyState == 4) 
        {     
         if(xmlHttp.status == 200) 
            {
            var textout = xmlHttp.responseText;     
            alert(textout);
            try
		{                 
                
                var xmlObj = xmlHttp.responseXml.documentElement;
                var master = document.getElementById('ajaxname');
                master.value=xmlObj.childNodes[0].firstChild.nodeValue; 
                alert(master.value);
              }
		catch(e)
		{
			try
			{
                        alert("hi1234");
                            var xmldom = new ActiveXObject('Microsoft.XMLDOM');                                
                            xmldom.async="false";                                 
			    xmldom.loadXML(textout);                             
			    xmlObj=xmldom.documentElement;	                           
                            var master = document.getElementById('ajaxname');
                            master.value = xmlObj.childNodes[0].firstChild.nodeValue;                         
                        }
	     	catch(e)
	     	{
		     	alert("Please use a new browser! This browser does not support XML!");        
	     	}
		}
            }
        }
     }

after your suggestion i tried this code buy it doesnt work with mozilla again ?
Reply With Quote  
Join Date: Sep 2005
Posts: 557
Reputation: digital-ether will become famous soon enough digital-ether will become famous soon enough 
Rep Power: 5
Solved Threads: 33
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Posting Pro

Re: Problem with ajax and mozilla browser

  #17  
Jan 24th, 2008
I misspelled responseXML. It should be

var xmlObj = xmlHttp.responseXML.documentElement;
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote  
Join Date: Mar 2006
Posts: 36
Reputation: sree22_happy is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
sree22_happy's Avatar
sree22_happy sree22_happy is offline Offline
Light Poster

Re: Problem with ajax and mozilla browser

  #18  
Jan 24th, 2008
It again doesn't work ?
var xmlObj = xmlHttp.responseXML.documentElement;
                alert(xmlObj);

i put this alert message.when explorer it displays [Object] and in Mozilla it displays [Object element]

after this code i put

 master.value=xmlObj.childNodes[0].firstChild.nodeValue; 
                alert(master.value); 

then this alert is not working i think this makes an exception ?
Last edited by sree22_happy : Jan 24th, 2008 at 10:39 pm.
Reply With Quote  
Join Date: Sep 2005
Posts: 557
Reputation: digital-ether will become famous soon enough digital-ether will become famous soon enough 
Rep Power: 5
Solved Threads: 33
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Posting Pro

Help Re: Problem with ajax and mozilla browser

  #19  
Jan 25th, 2008
Originally Posted by sree22_happy View Post
It again doesn't work ?
var xmlObj = xmlHttp.responseXML.documentElement;
                alert(xmlObj);

i put this alert message.when explorer it displays [Object] and in Mozilla it displays [Object element]

after this code i put

 master.value=xmlObj.childNodes[0].firstChild.nodeValue; 
                alert(master.value); 

then this alert is not working i think this makes an exception ?


Yes, the exception occurs at
 master.value=xmlObj.childNodes[0].firstChild.nodeValue; 

it seems.

In your catch block place an

alert(e);

So we can see what the exception is.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote  
Join Date: Mar 2006
Posts: 36
Reputation: sree22_happy is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
sree22_happy's Avatar
sree22_happy sree22_happy is offline Offline
Light Poster

Re: Problem with ajax and mozilla browser

  #20  
Jan 25th, 2008
yea the exception was
TypeError : xmlObj.childNodes[0].firstChild has no properties
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Marketplace (Sponsored Links)
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 2:03 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC