title: PHP jquery set checkbox value if checked or unchecked and post
body: <p>I want to set value for the check when it is unchecked. But every time I post my data whatever it is checked or unchecked, the value will be '1'</p>
  
  <p>I tried to set <code>!isset($check)</code> in <code>post.php</code>, but the value also will be 1.</p>
  
  <p>How can I set the different value when I uncheck the checkbox.</p>
  
  <pre><code>&lt;input type="checkbox" id="check" name="check" value="1"&gt;
  </code></pre>
  
  <p>The jquery code is below:</p>
  
  <pre><code>var check = $('#check').val();
  var Data = {check:check};
  $.ajax({
      type:"POST",
      url:"post.php",
      data:Data,
      beforeSend: function() {
          $("#btn-submit").html('sending');
      },
      success: function(data) {
      }
  });
  </code></pre>