title: This PHP script doesn't work in Internet explorer and Microsoft Edge but works in Chrome/Firefox/Safari/Opera
body: <p>I used PHP 5.6</p>
  
  <p>I wrote a php script which reads in a text file and picks a random line from it, then sends to the html whenever the button "Get a random line" is clicked. </p>
  
  <p>In Chrome/Firefox/Safari/Opera, this works fine but in Internet explorer and Microsoft edge, the output is always the same. It works only for the first time and doesn't change output after the first button click I mean, for the second and further clicks, the output has to change.</p>
  
  <p>Is there something that I have to handle specially for Internet Explorer and Microsoft Edge to get this done ?</p>
  
  <p>I tried using </p>
  
  <pre><code>//flush() 
  //ob_flush()
  //ob_end_flush()
  //session_write_close()
  </code></pre>
  
  <p>after and also before</p>
  
  <pre class="lang-php prettyprint-override"><code> echo $randomLine; //In the php script
  </code></pre>
  
  <p>but these didn't help.</p>
  
  <p>Can some one let me know what's going wrong ? Thanks..!!</p>
  
  <p>Update 1:</p>
  
  <p>The request is made with button click event through javascript:</p>
  
  <pre class="lang-js prettyprint-override"><code>function randomPathButtonClicked() 
  {
      var xmlhttp = new XMLHttpRequest();
      xmlhttp.onreadystatechange = function () {
          if (xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) {
              document.getElementById("randomPathId").textContent = xmlhttp.responseText;
          }
      };
      xmlhttp.open("GET", "serverSideRandomPathGenerator.php", true);
      xmlhttp.send();
  }
  </code></pre>
  
  <p>and the final line in php is like:</p>
  
  <pre class="lang-php prettyprint-override"><code>echo $selectedRandomLine;
  </code></pre>