title: How do I execute a PHP query on select option choice using AJAX?
body: <p>Okay I know this has been answered before (<a href="https://stackoverflow.com/questions/12210608/execute-php-script-on-same-page-after-selecting-a-dropdown-list-option-using-aja/12210750#12210750">Execute PHP script on same page after selecting a dropdown list option using Ajax or JavaScript</a>) but the answers weren't very helpful for someone who has never used AJAX before. How do I run a query like the one created if  someone selects an option from the drop down?</p>
  
  <pre><code>&lt;head&gt;
   &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;h3&gt;Subject&lt;/h3&gt;
  &lt;select name="allbooks" &gt;
                &lt;option value="none" &gt;&lt;/option&gt;
                &lt;option value="allbooks" &gt;All Books&lt;/option&gt;
      &lt;/select&gt;
  
  &lt;?php 
  $query = "SELECT * FROM books" or die("Error in the consult.." . mysqli_error($connection)); 
      $books = $connection-&gt;query($query);
  ?&gt;
  </code></pre>