title: Return PHP array to javascript wihout Ajax, possible?
body: <p>I have a javascript that, with Ajax, gets an array from PHP and adds this data to a dropdown. Its all working.</p>
  
  <p>It seems to me using Ajax for this is overkill, is there a more simple way?</p>
  
  <p>javascript:</p>
  
  <pre><code>function ajaxGetCountries(){
  
  var ajaxRequest;  
  
      try { // Opera 8.0+, Firefox, Safari    
          ajaxRequest = new XMLHttpRequest();
  
  //etc etc
      }
  
   ajaxRequest.onreadystatechange = function(){
      if(ajaxRequest.readyState == 4){
  
          allcountries = JSON.parse(ajaxRequest.responseText);
  
          var lst = document.getElementById('countrylst');
          for(var i = 0 ; i &lt; allcountries.length ; i++) {
              var opt = document.createElement('option');
              opt.innerHTML = allcountries[i];
              opt.value = allcountries [i];
              lst.appendChild(opt);
          }       
      }
   }
  
  ajaxRequest.open("GET", "get_countries.php" , true);
  ajaxRequest.send(null); 
  
  }
  </code></pre>
  
  <p>Thanks.</p>