Ciao a tutti. Vorrei inserire un flip switch on/off realizzato in html e css che grazie a Js mi vada ad eseguire il file action.php. Ho testo il file action.php da terminale tramite ./action.php e funziona correttamente ma quando inserisco il codice javascript non funziona. Ecco il codice::
html
codice HTML:
<meta name="robots" content="noindex">
<style id="jsbin-css">
            .onoffswitch {
        position: relative; width: 104px;
        -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
    }
    .onoffswitch-checkbox {
        display: none;
    }
    .onoffswitch-label {
        display: block; overflow: hidden; cursor: pointer;
        border: 2px solid #999999; border-radius: 20px;
    }
    .onoffswitch-inner {
        display: block; width: 200%; margin-left: -100%;
        transition: margin 0.3s ease-in 0s;
    }
    .onoffswitch-inner:before, .onoffswitch-inner:after {
        display: block; float: left; width: 50%; height: 30px; padding: 0; line-height: 30px;
        font-size: 13px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
        box-sizing: border-box;
    }
    .onoffswitch-inner:before {
        content: "Acceso";
        padding-left: 5px;
        background-color: #34A7C1; color: #FFFFFF;
    }
    .onoffswitch-inner:after {
        content: "Spento";
        padding-right: 5px;
        background-color: #F50505; color: #FAFAFA;
        text-align: right;
    }
    .onoffswitch-switch {
        display: block; width: 18px; margin: 6px;
        background: #FFFFFF;
        position: absolute; top: 0; bottom: 0;
        right: 70px;
        border: 2px solid #999999; border-radius: 20px;
        transition: all 0.3s ease-in 0s; 
    }
    .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
        margin-left: 0;
    }
    .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
        right: 0px; 
    }
</style>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>    <div class="onoffswitch">
        <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch">
        <label class="onoffswitch-label" for="myonoffswitch">
            <span class="onoffswitch-inner"></span>
            <span class="onoffswitch-switch"></span>
        </label>
    </div>

<script id="jsbin-javascript">
$("#myonoffswitch").click(function(){
            if($("#myonoffswitch").is(":checked"))
            {
                $(document).ready(function(){
            var jqxhr = $.getJSON('actionON.php', function(data) {
            value_update(data);
            }
            else
            {
                 $(document).ready(function(){
        var jqxhr = $.getJSON('actionOFF.php', function(data) {
            value_update(data);
            }
        });
</script>