title: jQuery Delete: Universal or Separate Functions?
body: <p>My project has multiple lists, such as People, Jobs, Ranks. For each list, I have separate jQuery code, that looks something like this:</p>
  
  <pre><code>$('dl.person li.delete').live("click", function() {
    var personDL = $(this).closest('dl');
  
    if (confirm("Really delete person '" + personDL.find('dt').text() + "' ?")) {
      $.ajax({
        type: "POST",
        url: "/people/do-delete",
        data: "person=" + personDL.attr('id'),
        dataType: "json",
        timeout: 8000,
        success: function(data) {
          personDL.fadeOut("slow", function() {
            personDL.remove();
            var t = (data.total != 1) ? ' person' : ' persons';
            $('h3 span#people').text(data.total + t);
          });
        }
      });
    }
  
    return false;
  });
  </code></pre>
  
  <p>As you can see, it would be pretty difficult to have one function to work for each list, as every instance of "person" needs to be replaced with "job", or "rank".</p>
  
  <p>Should I try to get a single function (and is there an easy way to do that?) or should I keep things as they are?</p>