title: CRUD methods with PHP, JS/jQuery, and a little AJAX
body: <p>I've been working on a system where you can create-read-update-delete to/from a table in a SQLite database.  So far I've only written the create and view methods (easy).</p>
  
  <p>Now, I have ran into a roadblock on deciding how to go about deleting and updating items.  On the view page, there is query to the database through php and a generation of the table (echoed through php into html).  There is also a button added next to each row that looks like a little trash can to delete the row.</p>
  
  <p>How can I use AJAX to simultaneously delete the row from the html table and sqlite table?  A more definitive question would be, how can I link each button to each row and query the database when the button is clicked?</p>
  
  <p>Here is the generated table:</p>
  
  <pre><code>foreach($result as $entry){
   echo  '&lt;tr&gt;' . '&lt;td&gt;'. $entry['department']. ' ' . $entry['CRN']. '&lt;/td&gt;' . 
      '&lt;td&gt;'. $entry['title'] . '&lt;/td&gt;' . 
      '&lt;td&gt;'. $entry['addDate'] . '&lt;/td&gt;'. 
      '&lt;td&gt;&lt;button class="fg-button fg-button-icon-left ui-state-default ui-corner-all"&gt;&lt;span class="ui-icon ui-icon-trash"&gt;&lt;/span&gt;&lt;/button&gt;&lt;/td&gt;'.'&lt;/tr&gt;';
  }
  </code></pre>