DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Been stuck on this same thing for about six months...

  1. #1
    Join Date
    Dec 2007
    Posts
    4

    Been stuck on this same thing for about six months...

    Website is http://www.sysintegration.com/

    I created it to try and learn AJAX.

    It's basically a two column CSS layout. The menu on the left and the content on the right are supposed to be loaded via AJAX calls like:

    HTML Code:
    <script type="text/javascript">makerequest('menu.html','menu');</script>
    <script type="text/javascript">makerequest('content.html','content');</script>
    I know I don't gain anything doing it this way, I am just trying to learn. Anyways, for some reason it only works about 80% of the time. The other 20% the page ends up loading only the left menu, only the right content, or neither one. If you hit refresh enough times, you'll see what I'm talking about.

    It's so frustrating and I have no idea what would make it do that.

    The code for the AJAX is below:
    Code:
    //Create a boolean variable to check for a valid Internet Explorer in
        
    var xmlhttp = false;
    
        //Check if we are using IE.
        try {
            //If the Javascript version is greater than 5.
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
                //If not, then use the older active x object.
                try {
                    //If we are using Internet Explorer.
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (E) {
                    //Else we must be using a non-IE browser.
                    xmlhttp = false;
                }
        }
    //If we are using a non-IE browser, create a javascript instance of t
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
       		  xmlhttp = new XMLHttpRequest();
    }
    				
    				
    function makerequest(serverPage, objID) {
    				 var obj = document.getElementById(objID);
    				 xmlhttp.open("GET", serverPage);
    				 xmlhttp.onreadystatechange = function() {
    				       if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
    				  		 obj.innerHTML = xmlhttp.responseText;
    				 }
    }

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    I hit refresh about a zillion times in a row and when it finally settled down, it all looked like it was supposed to.

    I'm using IE7

  3. #3
    Join Date
    Dec 2007
    Posts
    4

    Surprising

    You are the only one who has had it come up every single time. Everyone I know who has tried it has either the left menu missing or the content area missing at some point or another.

  4. #4
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Well, all I did was click your link and hit refresh about 20 times in a row.

    Is there something else you would like me to try in order to recreate this?

Similar Threads

  1. Replies: 2
    Last Post: 03-28-2008, 04:08 AM
  2. Restoring a database gets stuck in (loading) mode
    By Marc Pflieger in forum Database
    Replies: 0
    Last Post: 09-13-2002, 01:39 PM
  3. DLL gets stuck
    By Irfan Gowani in forum VB Classic
    Replies: 0
    Last Post: 06-04-2002, 03:41 AM
  4. Replies: 2
    Last Post: 06-07-2001, 10:14 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