title: AJAX isn't returning any data
body: <p>still fairly new to AJAX. I feel I'm not grasping it completely. I want to submit partial data  to the server, perform an SQL query and return the results. This is what I have so far:</p>
  
  <p><strong>jQuery</strong></p>
  
  <pre><code>j$('select[name=agent_Name]').change(function(event) {
       event.preventDefault();
       var agentID = j$(this).val();
       post_data = {'agent_ID':agentID};
       console.log("About to post data to the server");
      j$.post('../include/booking_Modify.php', post_data, function(response){  
          if(response.type == 'AgDEpCd'){
              output = response.text;
              console.log(output);
          }
          if(response.type == 'error'){
              output = response.text;
              console.log(output);
          }
      }, 'json');     
  });
  </code></pre>
  
  <p><strong>PHP</strong></p>
  
  <pre><code>&lt;?php
  session_start();
  require("../include/conn.php");
  dbopen();
  //check $_POST vars are set, exit if any missing
      if(!isset($_POST["agent_ID"]))
      {
          $output = json_encode(array('type'=&gt;'error', 'text' =&gt; 'Nothing was selected!'));
          die($output);
      }
  
      $stmt = $conn-&gt;prepare("SELECT AgDEpCd FROM AGENTS WHERE AgentID = ?");
      $stmt-&gt;bind_param('i', $_POST["agent_ID"]);   // bind variables to the parameter
      $stmt-&gt;execute();
  
      $row = $result-&gt;fetch_assoc();
      $AgDEpCd = $row['AgDEpCd'];
      $stmt-&gt;close();
      $output = json_encode(array('type'=&gt;'AgDEpCd', 'text' =&gt; $AgDEpCd));
      die($output);
  ?&gt;
  </code></pre>
  
  <p>I checked to make sure:
  the file path was correct. 
  var agentID = j$(this).val(); actually grabs a value, which it does
  Manually entered the SQL query into PHPMyAdmin to ensure I was retrieving results.
  I can't seem to return anything from the server. I'm not sure this is even possible. Please help!</p>