title: JQuery, Ajax, Handlebars clear table then repopulate
body: <p>Build a form that goes out and grabs data then populates a table using handlebars.js.  Works great on the first go around then won't populate again if data is changed. Any ideas on how to get this to work?</p>
  
  <pre><code>$('a.button').on("click", function(e){
          e.preventDefault();
  
          var date = $('#datepicker').val();
          var func = "get_all_swo_by_date";
          //$('table.output').empty();
  
          $.ajax({
              url: "../includes/db_functions.inc.php",
              type: "post",
              data: ({ p : date, f : func }),
              dataType: "json",
              success: function(results) {
                  var source = $("#entry-template").html();
                  var template = Handlebars.compile(source);
                  $('table.output').empty();
                  if(results.length &gt; 0)
                  {
                      $.each(results, function(i, context){
                          $('table.output').append( template(context) );
                      });
                  } else {
                      $('table.output').append("There is no data to return.");
                  }
  
              }
          });
      });
  </code></pre>
  
  <p>When the "a" with a class of button is clicked it populates the table.. (as stated above).  Ok now when you change datepicker to another date and click the "a" with a class of button it will not repopulate the table. </p>
  
  <p>If someone has a legitimate idea of why it doesn't work please let me know.  Please don't just make up stuff. I can do that plenty on my own.. :)  </p>