title: html onload not triggering after ajax call in Internet Explorer,
body: <p>I have an ajax call to a php script which runs some things on the server. When this is completed I want to make php call out a javascript function. To do this I used this.</p>
  
  <pre><code>//This line works in chrome and firefox.
  echo "&lt;style onload='test()'&gt;&lt;/style&gt;";
  //this one doesnt work after an ajax call.
  echo "&lt;script type='text/javascript'&gt;test()&lt;/script&gt;";
  </code></pre>
  
  <p>This line works and triggers in chrome and firefox, but not in internet explorer.</p>
  
  <p><strong>So my question is, is there a solution or an alternative for this?</strong><br>
  Is there a way to call a new javascript function after an ajax call depending on the result of the ajax call? (not just succes or failure)</p>
  
  <p>Ill explain my system a bit more for extra information. I store a lot of my data in a session.</p>
  
  <p>I got my code here and stripped it from extra or useless code for this example, during this spelling errors, parse errors or other syntax errors might have occurred <strong>this is not the problem</strong> though.</p>
  
  <pre><code>//Index.php
  &lt;head&gt;&lt;script src='location' type='text/javascript'&gt;&lt;/script&gt;&lt;/head&gt;
  &lt;body&gt;
     &lt;div id='container'&gt;
        &lt;div id='head'&gt;&lt;/div&gt;
        &lt;div id='content'&gt;&lt;/div&gt;
     &lt;/div&gt;
     &lt;div id='hidden'&gt;&lt;/div&gt; // this div is hidden for js feedback
     &lt;script type='text/javascript'&gt;loadContent();&lt;/script&gt;
  &lt;/body&gt;
  
  //javascript file
  function loadContent(){
      //my ajax function works it requires 3 variables
      //url to php, div that will be changed, array with post variables.
      Ajax("urltophp", "hidden", Array(""));
  }
  
  function loadHome(){
      Ajax("urltophp2", "head", Array("headhome"));
      Ajax("urltophp2", "cont", Array("conthome"));
  }
  
  function loadLogin(){
      Ajax("urltophp2", "head", Array("headlogin"));
      Ajax("urltophp2", "cont", Array("contlogin"));
  }
  
  function test(){
      alert("test"); //for testing
  }
  
  //then urltophp
  $ses = $_SESSION("ses"); //this is an object of class SESSION
  $timeout = $ses-&gt;getTimeout();
  $loggedin = $ses-&gt;getLoggedin();
  //THIS WORKS IN CHROME AND FIREFOX NOT IN IE.
  if(time() - $timeout &lt; 3600){  //if an hour hasnt passed since last action.
      if($loggedin){             //if user was logged in.   
          echo "&lt;style onload='loadHome()'&gt;&lt;/style&gt;";
      }else{
          echo "&lt;style onload='loadLogin()'&gt;&lt;/style&gt;";
      }
  }
  
  //urltophp2
  $p = $_POST['var1'];
  $ses = $_SESSION["ses"];
  //used for checking if user is logged in before loading page 
  //in case of cross-site scripting. left out in this example.
  $loggedin = $ses-&gt;getloggedin();
  switch($p){
      case "headhome":
      echo $homehead;  //assume I loaded this from a file.
      break;
      case "conthome":
      echo $conthead;  //assume the same.
      break;
      etc. for all options.
  }
  </code></pre>
  
  <p>Thanks in advance kpp.</p>