Jump to content

IE / Firefox query


woolyg

Recommended Posts

Hi all,

 

Just a quick query regarding the way that IE (specifically 7) handles AJAX calls.

 

I'm using a standard getData call to get info from an external PHP file. It displays fine.

However, if any changes are made to the external PHP file (say, I changed an image on it for display purposes) and I click on the link to call the AJAX in IE, the original image is shown, not the new one.

 

If I do the same thing in Firefox, the new image displays without needing to open a new browser window and 'refresh' the AJAX.

 

Has anyone else had this problem?

Is there an easy fix to make IE show the most up-to-date info in a PHP call?

 

This is really messing with my cross-browser compatibility stuff...!

 

Cheers,

WoolyG

Link to comment
Share on other sites

Use this for image handle for me working.

 


/**
* @GetXmlHttpObject used to detect the browser and set
* xmlHttp
*
*/
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;
}


/**
* @ajax_php_get used to detect the browser and fix required images
* Function to be called from the main pages.
* ajax_php_get(this.options[this.selectedIndex].value);
* price.options[price.selectedIndex].value + ' ' + this.options[this.selectedIndex].value
*
*/
function ajax_php_get(str1, str2, str3, str4){
  // Set xmlHttp object for browser
  xmlHttp=GetXmlHttpObject();
  // Condition for browser
  if (xmlHttp==null){
    alert ("This browser does not support AJAX!");
    return;
  }
  // Variable setup for php or asp
  var url="callback.php";
  url=url+"?q1="+str1+"&q2="+str2+"&q3="+str3+"&q4="+str4;
  // Must be used , dont change
  url=url+"&sid="+Math.random();

  // Call output function
  if(str1=="2"){
      xmlHttp.onreadystatechange=ajax_php_output1;
  }else{
    xmlHttp.onreadystatechange=ajax_php_output0;
  }
  // Execute GET method
  xmlHttp.open("GET",url,true);
  // Send Get or Post method
  xmlHttp.send(null);
}



/**
* @A B leg
* Dataarrival event
*
*/
function ajax_ab_leg1(vAcmd,vBcmd){

    var Aleg = document.getElementById("a1");
    var Bleg = document.getElementById("b1");

    if (vAcmd == "on"){
        Aleg.src = "img/try.gif";
    }else if(vAcmd == "ring"){
        Aleg.src = "img/talk.gif";
    }else if(vAcmd == "trying"){
        Aleg.src = "img/busy.gif";
    }else{
        Aleg.src = "img/none.gif";
    }

    if (vBcmd=="on"){
        Bleg.src = "img/try.gif";
    }else{
        Bleg.src = "img/none.gif";
    }

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.