SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Ajax on Firefox

  1. #1
    SitePoint Zealot maileen's Avatar
    Join Date
    Apr 2006
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Ajax on Firefox

    Hi,

    I have a AJAXcode using a PHP page.
    it works perfectly under IE7, Opera 9 and Safari, but under Firefox, nothing works.

    here is the code :
    Code:
    function ajaxFunction()
    {
    	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;
    		    	}
    		}
    	}
    	return xmlhttp;
    }
    
    
    function LoadPage(objid, pg)
    {
    	var obj = document.getElementById(objid);
    	xmlhttp = ajaxFunction(); // create xmlHttpRequest object.
    	
    	xmlhttp.open("GET", pg, true);
    	alert("xmlhttp object " + xmlhttp);
    
    	xmlhttp.onreadystatechange = function()
    	{
    		alert("state r : "+xmlhttp.readyState);
    		if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
    		{
    			//alert("Response : <div>" + xmlhttp.responseText +"</div>");
    			obj.innerHTML = xmlhttp.responseText;
    		}
    	}
    	xmlhttp.send(null);
    }
    so it display correctly the alert message showing the cmlhttp object, however, it's like it never enters into the function :
    Code:
    xmlhttp.onreadystatechange = function(){..}
    and i do not know why ?

    does someone have a clue ?

    thanks a lot

  2. #2
    SitePoint Zealot maileen's Avatar
    Join Date
    Apr 2006
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok i solved my problem but it is still not clear how :-(
    basically i had firebug 1.0 installed, i've just updated it with beta version 1.1 and not it works.

    i really do not understand why...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •