title: Load data from a MySQL query into a page with jQuery
body: <p>I'd like to query a database and upload entries from that database into fields on a webpage. However, the only way I currently know to do that is create a webpage in PHP that performs the query, prints it onto a page in a readable fashion, and then load that page with ajax and parse through the HTML. That seems like a very roundabout way of doing it-- so is there anything I can do which is more direct?</p>
  
  <p>To be clear: I have a dropdown menu:</p>
  
  <pre><code>&lt;select name="items" id="items" size=[php variable] onChange="javascript:updatePage()"&gt;
      &lt;option value="[database entry ID]"&gt;[php variable]&lt;/options&gt;
      &lt;option value="[database entry ID]"&gt;[php variable]&lt;/options&gt;
  &lt;textarea name="stuff" id="stuff"&gt;
  &lt;/textarea&gt;&lt;br&gt;
  </code></pre>
  
  <p>And then later on I'll have:</p>
  
  <pre><code>&lt;script src="jquery.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      function updatePage()
      {
          var itemToLoad = $('#items').val();
          $.ajax({
              type: "POST",
              url: 'updatepage.php',
              data: "itemtoload=" + itemToLoad,
              success: function(data) {
                  var stuff = data;
                  stuff = parseWhatINeed(stuff);
                  $('#stuff').text(stuff);
              }
          });
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>And updatepage.php does a MySQL query, and the parseWhatINeed function parses what I need from the html in the data variable. Is there a better way of going about this?</p>