title: jquery submit form with checkbox
body: <p>So I want to submit only when a checkbox is checked (I want to do something else when a checkbox is unchecked). I've been trying to get this checkbox submit to work but not no avail. Here's what I have:</p>
  
  <pre><code>$('#checkbox').click(function() { 
      if ($(this).attr('checked')) {
          $("#form").submit(function () {
              var newvals = $("#form").serialize();   // serialize data
  
              $.post('save.php', newvals, function(data) { 
                  $("#content").html(data);
              }); // posting data and dumping response onto page      
  
              return false;
          }); 
  
      } else {
  
          alert(2); // placeholder for what i want to do otherwise
      }
  
  });
  </code></pre>
  
  <p>I looked around and was poking around with <code>.trigger</code> and <code>.live</code>, but I'm having problems even thinking about how the logic would even work with those functions. I'm not opposed to using them as long as I can distinguish between a 'checked' box and an 'unchecked' box.</p>
  
  <p>Any ideas?</p>