AJAX, Firefox and innerHTML


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: AJAX, Firefox and innerHTML

  1. #1
    Join Date
    Dec 2006
    Posts
    1

    AJAX, Firefox and innerHTML

    Hi everybody!

    The function below puts data in two HTML div containers on a webpage. In Internet Explorer, it works perfectly. However in Firefox, it only works for the "bookedShifts" div container - nothing appears in the second container?? If I uncomment the alert statement however, all the correct HTML is correctly stored in responseText, so I have no idea why innerHTML didnt put it in there! Anybody got any suggestions? Thanks very much for your help!

    Code:
     
        function updateShifts() {
        
          /* Update booked shifts section */
          var xhoBooked=GetXmlHttpObject();
          if (!xhoBooked) {
            alert( "This browser does not support the technology required to use this website.");
            return false;
          }
          url = "phplib.php?function=updateBookedShifts";
          var bookedShiftsContainer = document.getElementById('bookedShifts');
          xhoBooked.onreadystatechange = function() {
            if ( xhoBooked.readyState == 4 ) {
              bookedShiftsContainer.innerHTML = xhoBooked.responseText;
            }
          }
          xhoBooked.open( "GET", url, true );
          xhoBooked.send( null );    
    
          /* Update available shifts section */
          var xhoAvail=GetXmlHttpObject();
          if (!xhoAvail) {
            alert( "This browser does not support the technology required to use this website.");
            return false;
          }      
          url = "phplib.php?function=updateAvailShifts";
          var availShiftsContainer = document.getElementById('availShifts');
          xhoAvail.onreadystatechange = function() {
            if ( xhoAvail.readyState == 4 ) {
              availShiftsContainer.innerHTML = xhoAvail.responseText;
              //alert( xhoAvail.responseText );
            }
          }
          xhoAvail.open( "GET", url, true );
          xhoAvail.send( null );      
    }

  2. #2
    Join Date
    Jan 2007
    Posts
    2
    Get FireBug - it will help you debug the issue. Set a breakpoint where the problem is, and things will become clear.

  3. #3
    Join Date
    Jul 2004
    Location
    NYC
    Posts
    35
    there doesn't seem to be anything wrong with the code. maybe you can show us more, in case the error is in another location?
    "Those who would sacrifice liberty for security, deserve neither liberty nor security." -- Benjamin Franklin

Similar Threads

  1. innerHTML Alternative in Firefox
    By visualAd in forum AJAX
    Replies: 0
    Last Post: 03-04-2006, 05:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center