jeudi 7 juin 2018

Send multiple data for one checkbox by ajax without submit form

I create checkbox form sql /and want to send data by click checkbox / but data not send.

this is my checkbox loop

<ul>
    <?php while($objResult = mysqli_fetch_array($objQuery)){
    ?>
        <li>
            <input class="checkbox" type="checkbox" id="cb<?php echo $objResult["mid"] ?>" 
            onclick="save_checkbox(<?php echo $objResult["mid"] ?>,<?php echo $objResult["mpass"] ?>,date('Y-m-d'));"/>
        </li>
    <?php } ?>
</ul>

ajax function

<script>
    function save_checkbox(mission_id, record_check, date) {
        $.post('ASEngine/ASCheckpass.php', {
            mid : mission_id,
            check : record_check,
            date : date
        }, function(response) {
            alert("Hello! I am an alert box!!");
            $("[id ^='cb']").html(response);
        });
    }
</script>

PHP

<?php
$mid = $_POST["mid"];
$check = $_POST["check"];
$date = $_POST["date"];
//query
?>

I can't send data to my php Help me please..




Aucun commentaire:

Enregistrer un commentaire