Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: IE Ajax problem

  1. #1
    New to the CF scene
    Join Date
    May 2009
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Internet Explorer IE Ajax problem

    I must start with I am very new with javascript. I know what I can find basically. But this site I am working on works on both Firefox and Chrome. But It will not work on IE and don't know why. Here is what I have:

    Main Page
    Code:
    <td valign="top" width="40%">
     <span id="gearInfo" name="gearInfo"> 
     </span></td>
    Iframe inside Main Page

    Code:
    <script src="showgear.js" type="text/javascript"></script>
    
    <div class="gearitem">
        <button value="<?php echo $row['type'];?>" onclick="showGear(this.value)">
          <img class="thumbnail" src="images/<?php echo $row['image'];?>">
        </button>
      </div>
    Here is a populated copy of the above code:
    Code:
      <div class="gearitem">
        <button value="Backpack" onclick="showGear(this.value)">
          <img class="thumbnail" src="images/palisade80_backpack.gif">
        </button>
      </div>
    Here is the script:
    Code:
    var xmlHttp
    
    function showGear(str)
    { 
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null)
     {
     alert ("Browser does not support HTTP Request")
     return
     }
    var url="getgear.php"
    url=url+"?q="+str
    url=url+"&sid="+Math.random()
    xmlHttp.onreadystatechange=stateChanged 
    xmlHttp.open("GET",url,true)
    xmlHttp.send(null)
    }
    
    function stateChanged() 
    { 
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     { 
     parent.document.getElementById('gearInfo').innerHTML=xmlHttp.responseText 
     } 
    }
    
    function GetXmlHttpObject()
    {
    var xmlHttp=null;
    try
     {
     // Firefox, Opera 8.0+, Safari
     xmlHttp=new XMLHttpRequest();
     }
    catch (e)
     {
     //Internet Explorer
     try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
     catch (e)
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
     }
    return xmlHttp;
    }
    Last edited by unclhos; 05-31-2009 at 06:11 AM.

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,184
    Thanks
    10
    Thanked 569 Times in 550 Posts
    try top instead of parent in parent.document.
    also try calling .open() before setting onreadystatechange.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5

  • #3
    New to the CF scene
    Join Date
    May 2009
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thank You, I have tried those two items with no success. But it does still work on chrome, so most likly Firefox too, haven't been able to check that one. Here is the link to the websites page that I am working on: www.nibiruweb.com/cyfi/gear.php

  • #4
    New to the CF scene
    Join Date
    May 2009
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Ok so I have been researching the Problem with IE, and have tried a few things that people have said were work arounds but still with no success. I have tried using the meta tags for caching to have the page expire but still doesn't work. Anyone have any other ideas?? If not I will just have to force people to use the better web browers out there(haha).

    Any tips for changing it to a POST format?
    Last edited by unclhos; 06-01-2009 at 09:50 PM.


  •  

    Tags for this Thread

    Posting Permissions

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