1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Ajax in IE < v7

Discussion in 'JavaScript' started by cesarcesar, May 30, 2007.

  1. #1
    Hello,

    I have a IE issue to resolve. Using the code found here, http://www.wrgd.com/assets/js/ajax-get-set.js, my AJAX calls send and recieve fine in FF and IE 7, but in earlier IE versions like 6.0.2900..... especially it fails. All it returns is "Started..." which is at line 87. How can i make this work in IE < v7?

    There has to be a fix out there. Thanks for all your help.
     
    cesarcesar, May 30, 2007 IP
  2. DavidMerrilees

    DavidMerrilees Guest

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hi

    The problem for IE6 is your getData function does not create a valid ActiveXObject. Replace these lines:

    
     if(window.XMLHttpRequest)
      req = new XMLHttpRequest();
     else if (window.ActiveXObject)
      req  = new ActiveXObject(Microsoft.XMLHTTP);
    
    HTML:
    with

    
                                    var req; 
    				try
    				{
    					req = new XMLHttpRequest();
    				}
    				catch (e1)
    				{ 
    					// Internet Explorer Browsers
    					try
    					{ 
    						req = new ActiveXObject("Msxml2.XMLHTTP");
    					}
    					catch (e2) 
    					{ 
    						
    						try
    						{ 
    							req = new ActiveXObject("Microsoft.XMLHTTP");
    						}
    						catch (e3)
    						{ 
    							return false;
    						}
    					}
    				}
    
    HTML:
     
    DavidMerrilees, May 31, 2007 IP
  3. cesarcesar

    cesarcesar Peon

    Messages:
    188
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    that works perfectly. thank so much.
     
    cesarcesar, May 31, 2007 IP