jQuery / Javascript - submit form when checkbox is clicked

ajax, html, javascript, jquery

Solution

<form id="form" method="post" action="">
    <input type="checkbox" name="checkbox" class="checkbox"/>
    </form> 
    <script type="text/javascript">  
        $(function(){
         $('.checkbox').on('change',function(){
            $('#form').submit();
            });
        });
    </script>

OR

<form id="form" method="post" action="">
<input type="checkbox" onchange="$('#form').submit();"  name="checkbox" class="checkbox"/>
</form>

Problem

I have a page where I display results form database and there are checkboxs which filter ther results. The problem is that I don't want to use submit button because I would like to let the user only click on the checkboxes to get the desired results. So is there anyway using javascript or jquery to submit a form when checkbox is checked with no submit button? if you see on shopping sites there are no submit buttons just the checkboxes..Like that. thanks ``` <form> <input type="checkbox" name="size" > Size </form> ``` here is the php ``` <?php if (isset($_POST["size"])){ //do something ?> ```

Original source