title: Allow only one query result per table cell
body: <p>I have a jquery script that accesses a db and returns a numeric result and writes that result into a table cell. This scripts runs when the page loads but also when the drop down menu is changed. I want to be able to limit only 1 result per table cell. </p>
  
  <p>Right now when page loads it writes the result to the cell and when the drop down menu is changed it just adds the new result to the cell instead of replacing it.</p>
  
  <p>I have search quite a bit trying to figure out how to do this and can not come up with anything. Can someone help me?</p>
  
  <p>Here is the jQuery:</p>
  
  <pre><code>$(document).ready(function(){
  
  $('.typeval').change(function(){
      var movement    =  $(this).val();
      var client_id   = $(this).parent().siblings().find('.clientval').val();
      var class_id    = &lt;? echo $class_id; ?&gt;;
          $count      = $(this).parents('tr').find('label.count');
  
  $.ajax({ 
    type: "POST",
    url: "movement_count.php",
    data: {movement:movement, client_id:client_id, class_id:class_id},
    dataType: "json", 
    async: false,
    success:(function(output) {      
  
        $.each(output, function(index, value){
       //alert(value);
       $count.append(output[index]);
       }); // each
       })     
  }) // ajax
  
  }).change(); // .typeval
  
  });  // document
  </code></pre>
  
  <p>Here is the table cell where I only want to show one result at a time.</p>
  
  <pre><code>&lt;td&gt;&lt;label class="count"&gt;5&lt;/label&gt;&lt;/td&gt;
  </code></pre>
  
  <p>Please let me know if I have not provided enough info for the assistance needed.</p>