title: xmlhttprequest not passing variable from javascript to php
body: <p>I am make an interactive map in D3. I stored all data in MySQL database. Since the user is able to select year to see all data, I have to pass the year to server side(php) to query about the data of the specific year. </p>
  
  <p>I do not know specific function in D3.js to help us pass variables to php, so I use XMLHTTP to send information to php.<br>
  My javascript:</p>
  
  <pre><code>a = "ARGGDP"
  var xmlHttp = new XMLHttpRequest();
  xmlHttp.open("GET", "database/allcountry.php?a=a", true);
  xmlHttp.addEventListener("load", ajaxCallback, false);
  xmlHttp.send(null);
  
  function ajaxCallback(event){
      alert( "loaded");
  }
  </code></pre>
  
  <p>My php
  
  
  <p>header("Content-Type: application/json");</p>
  
  <pre><code>$a = $_GET['a'];
  $username = "root"; 
  </code></pre>
  
  <p>However, it shows "Undefined index: a". Any idea about what should I do to fix this problem? </p>