title: Toggle Checkbox and send query in background to update database
body: <p>As soon as someone toggles a checkbox. I want a the value sent to a php page for it to update it in my database.</p>
  
  <p><a href="https://i.stack.imgur.com/ml3rk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ml3rk.png" alt="enter image description here"></a></p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div class="form-group"&gt;
    &lt;div class="tg-optionbox"&gt;
      &lt;span&gt;Promotional Video&lt;/span&gt;
      &lt;span class="tg-iosstylcheckbox"&gt;
       &lt;input type="checkbox" id="video" name="video" value="video"&gt;
       &lt;label for="video"&gt;&lt;/label&gt;
        &lt;div id="echo2"&gt;&lt;/div&gt;
       &lt;/span&gt;
     &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>JQUERY:</p>
  
  <pre><code>$(document).ready(function(){
    $("input[type=checkbox]").click(function () {
        $.ajax({
            type: "POST",
            url: "get/update-feature.php",
            data: {
                value: $('input:checkbox:checker').val()
            },
            success: function(data) {
                $('#echo2').html(data); 
            }
        });
    });
  });
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>    &lt;?
  $sent_value = $_POST['value'];
  
  if(isset($sent_value)){
          //update database
          echo "updated";
  }else{
          //update database
  }
  
          ?&gt;
  </code></pre>
  
  <p>Currently, my jquery doesn't work. How I need it:</p>
  
  <ul>
  <li>They click the orange checkbox toggle</li>
  <li>Jquery recognises this and sends the checkbox value to my php page</li>
  <li>my php page gets the value and puts it in the database</li>
  </ul>