Track allDaySwitch (How can I save the state of the allDaySwitch) via PHP and Javascript

Hello, my question is how can I save the state of the allDaySwitch with PHP and Javascript (using phpmyadmin as the database)?
This is my code until now:
Javascript:

var data = {
                id_verm: tempEvent.id_verm,
                startdatum: formatDate(tempEvent.start),
                enddatum: formatDate(tempEvent.end),
                title: tempEvent.title,
                name: tempEvent.name,
                vorname: tempEvent.vorname,
                lonza_nr: tempEvent.lonza_nr,
                tel_nr: tempEvent.tel_nr,
                email: tempEvent.email,
                anmerkungen: tempEvent.description,
                allDay: mobiscroll.getInst(allDaySwitch).checked,
                // this is the id from the ressources, got the values from db table hebebühnen
                fk_hebebuehne: tempEvent.resource,
                fk_user: 1,
            };

        // Use an AJAX request to send the data to a server-side script
        $.ajax({
            type: "POST",
            url: "save.php",
            data: data,
            success: function(response) {
                alert(response);
                console.log("Data saved successfully");
            }
        });

PHP save.php

I defined the ‘ganztaegig’ as a tinyint in the database. It should be boolean, but it automatically turns it into a tinyint. True should be 1 and 0 should be false then. I dont know how I can give these values to the allDaySwitch.

Thank you in advance :smile:

Hi Nicola,

In this docs section you can see an example on how can you change the switch value dynamically. Also it should work with boolean and with number (0 or 1) values as well.