title: jQuery Datatable: Edit button
body: <p>I added <code>Edit</code> button to my <code>jQuery Datatable</code>. When the user clicks on this button, the row becomes editable. Updated row should be saved to MySQL DB, but here comes the problem - the updated row is not saved to DB. Firebug does not show any error message. Can someone help me figure out the problem?</p>
  
  <pre><code>&lt;script type="text/javascript" charset="utf-8"&gt;
           $(document).ready(function(){
                $('#newspaper-b').dataTable({
                "sPaginationType":"full_numbers",
                "aaSorting":[[3, "asc"]],
                "bJQueryUI":true
                });
               $(".edit_but").click(function() {
                var ID=$(this).attr('id');
                $("#first_"+ID).hide();
                $("#last_"+ID).hide();
                $("#first_input_"+ID).show();
                $("#last_input_"+ID).show();
            });
               $(".edit_tr").change(function() {
                    var ID=$(this).attr('id');
                    var first=$("#first_input_"+ID).val();
                    var last=$("#last_input_"+ID).val();
                    var dataString = 'flightNum='+ ID +'&amp;from='+first+'&amp;STADate='+last;
                    $("#first_"+ID).html('&lt;img src="load.gif" /&gt;'); // Loading image
                    if(first.length&gt;0&amp;&amp; last.length&gt;0) {
                    $.ajax({
                        type: "POST",
                        url: "callpage.php?page=tables/edit.php",
                        data: dataString,
                        cache: false,
                        success: function(html) {
                                $("#first_"+ID).html(first);
                                $("#last_"+ID).html(last);
                        }
                    });
                    } else
                    {
                      alert('All fields must be filled out.');
                    }
                  });
                // Edit input box click action
                $(".editbox").mouseup(function() {
                  return false
                });
  
                // Outside click action
                $(document).mouseup(function() {
                    $(".editbox").hide();
                    $(".text").show();
                });
  
                $("tr").click(function(){
                  $(this).addClass("selected").siblings().removeClass("selected");
                });
       });
  &lt;/script&gt;
  
                  &lt;table id="newspaper-b" border="0" cellspacing="2" cellpadding="2" width = "100%"&gt;
                      &lt;thead&gt;
                          &lt;tr&gt;
                              &lt;th scope="col"&gt;Flt Num&lt;/th&gt;
                              &lt;th scope="col"&gt;From&lt;/th&gt;
                              &lt;th scope="col"&gt;STA Date&lt;/th&gt;
                              &lt;th scope="col"&gt;&lt;/th&gt;
                          &lt;/tr&gt;
                      &lt;/thead&gt;
                      &lt;tbody&gt;
                          &lt;?php foreach ($result1 as $row):
                              $flightNum=$row['flightNum'];
                              $from=$row['frm'];
                              $STADate=$row['STADate'];
                          ?&gt;
                          &lt;tr id="&lt;?php echo $flightNum; ?&gt;" class="edit_tr"&gt;
                                                          &lt;td&gt;&lt;?php echo $row['flightNum'];?&gt;&lt;/td&gt;
                              &lt;td class="edit_td"&gt;
                                  &lt;span id="first_&lt;?php echo $flightNum; ?&gt;" class="text"&gt;
                                      &lt;?php echo $from;?&gt;
                                  &lt;/span&gt;
                                  &lt;input type="text" value="&lt;?php echo $from;?&gt;" 
                                         class="editbox" id="first_input_&lt;?php echo $flightNum; ?&gt;"/&gt;
                              &lt;/td&gt;
                              &lt;td class="edit_td"&gt;
                                  &lt;span id="last_&lt;?php echo $flightNum; ?&gt;" class="text"&gt;
                                      &lt;?php echo $STADate; ?&gt;
                                  &lt;/span&gt; 
                                  &lt;input type="text" value="&lt;?php echo $STADate; ?&gt;" 
                                         class="editbox" id="last_input_&lt;?php echo $flightNum; ?&gt;"/&gt;
                              &lt;/td&gt;
                                                          &lt;td class="edit_td"&gt;&lt;?php echo $row['pkID']; ?&gt;&lt;/td&gt;
                              &lt;td id="&lt;?php echo $flightNum; ?&gt;" class="edit_but"&gt;
                                  &lt;div&gt;
                                      &lt;img src='images/edit.png' alt='Edit' /&gt;
                                  &lt;/div&gt;
                              &lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;?php endforeach;?&gt;
                      &lt;/tbody&gt;
                  &lt;/table&gt;    
  </code></pre>
  
  <p><strong>edit.php</strong></p>
  
  <pre><code>&lt;?php
      include_once 'include/DatabaseConnector.php';
      if(isset($_POST['flightNum'])) {
          $flightnum=$_POST['flightNum'];
          $from=$_POST['from'];
          $STADate=$_POST['STADate'];
          $query = 'UPDATE flightschedule 
                    SET frm="'.$from.'",STADate="'.$STADate.'" 
                    WHERE flightNum="'.$flightNum.'"';
          DatabaseConnector::ExecuteQuery($query);
          echo '1';
      } else { 
          echo '0'; 
      }
  ?&gt;
  </code></pre>