title: JavaScript Not Returning Data But No Error Either
body: <p>I am calling a php file that queries my database and returns a result.  I have verified that the php file accurately returns the data as needed, but my calling page is not updated from the JavaScript.  </p>
  
  <p>What do I need to alter in my syntax below so that the returned value is returned on page?</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function boostion()
  {
  var xhr;
   if (window.XMLHttpRequest) { 
      xhr = new XMLHttpRequest();
  } else if (window.ActiveXObject) { 
      xhr = new ActiveXObject("Microsoft.XMLHTTP");
  }
       xhr.open("GET", "QueryDB.php", true); 
       xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");                  
       xhr.onreadystatechange = display_data;
      function display_data() {
       if (xhr.readyState == 4) {
        if (xhr.status == 200) {     
        document.getElementById("data").innerHTML = xhr.responseText;
        } else {
          alert('There was a problem with the request.');
        }
       }
      }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>EDIT</strong><br>
  I have also opened Developer Options in Chrome and checked the Console and there are no errors or issues displayed, everything is a success!</p>
  
  <p><strong>Edit 2</strong><br>
  I tried to use the JQuery approach below and used this syntax - but I get the error</p>
  
  <blockquote>
    <p>Uncaught TypeError: $(...).load is not a function</p>
  </blockquote>
  
  <p>Syntax:</p>
  
  <pre><code>&lt;script src="https://code.jquery.com/jquery-3.1.1.slim.js" 
      integrity="sha256-5i/mQ300M779N2OVDrl16lbohwXNUdzL/R2aVUXyXWA=" 
      crossorigin="anonymous" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  $(window).load(function(){
   $.get("QueryDB.php", function(data, status){
  document.getElementById("data").innerHTML = data;
  });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>Edit 3</strong><br>
  This is my php syntax that runs the sql syntax and echo result that I want to have returned from the javascript</p>
  
  <pre><code>&lt;?php
      $option = array(); 
  
      $option['driver']   = 'mssql';
      $option['host']     = 'host';
      $option['user']     = 'user';       
      $option['password'] = 'password';   
      $option['database'] = 'database';     
      $option['prefix']   = '';            
  
      $db = JDatabase::getInstance( $option );
      $result = $db-&gt;getQuery(true);
      $result-&gt;select($db-&gt;quoteName(array('trackandfieldresults')));
      $result-&gt;from($db-&gt;quoteName('[TrackData]')); 
      $db-&gt;setQuery($result); 
      $row = $db-&gt;loadRowList();
      echo $row['0']
  ?&gt;
  </code></pre>