vendredi 21 décembre 2018

Ajax Checkbox post on change with multiple ID's on one page

Im trying to post the status of all rows on change checkbox status, but it doesnt work at the moment. Where is the problem i cant see ?

My ajax request code is above ;

<script>

$( document ).ready(function() {
$("checkbox[id^=number]").change (function () {

var value = $(this).val();

if (confirm("Are You Sure ?")){

$.ajax({
    type: "POST",
    url: "ajaxislem.php?islem=teslimat",
    async: true,
    data: {
        ilid: $(this).data("id") 
    },
    success: function (msg) {



         $('.onayli').html(msg).show(); 

    }
});

  }
}) ;});
</script>

And my checkboxes above :

<label><input id="number1" data-id="1" checked type="checkbox" checked> <b><span class="onayli"><font color="green"> Açık</font></span></b> </label>
    <label><input id="number2" data-id="2" checked type="checkbox"  checked> <b><span class="onayli"><font color="green"> Açık</font></span></b> </label>
    <label><input id="number3" data-id="3" checked type="checkbox"  checked> <b><span class="onayli"><font color="green"> Açık</font></span></b> </label>




Aucun commentaire:

Enregistrer un commentaire