title: Making an AJAX call to update the database onChange of a textarea
body: <p>I am trying to create a feature on my website that automatically updates the database onchange of the textarea below (which is going to be act as a 'post-it note for reminders'). I am new to ajax, and I was wondering if someone can show me a basic example of how I would make an AJAX call to update my database onChange of the textarea below?</p>
  
  <pre><code>&lt;?php
  //Create mysql connect variable
  $conn = mysql_connect('samplesource.com', 'example', 'pass');
  
  //kill connection if error occurs
  if(!$conn){
      die('Error: Unable to connect.' . '&lt;br&gt;' . mysql_error());
  }
  //connect to mysql database
  mysql_select_db("mydb", $conn);
  
  session_start();
  $userid = $_SESSION['id'];
  
  $results = ("SELECT * FROM notes WHERE userid='$userid'");
  ?&gt;
  
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;practice&lt;/title&gt;
  &lt;script src="jquery.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  $(document).ready(function() {     
      $(".sometext").change(function(){   
          //make ajax call to update database onChange    
      }); 
  }); 
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;textarea class="note" style="resize:none; width:300px; height:200px;"&gt; &lt;/textarea&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>