jeudi 10 novembre 2016

Check if No checkbox checked before calling DestroyeAll Function

If no checkbox is selected an alert should be show no Record Selected if checkboxes checked it should then go to Controller otherwise just alert to checkbox before Delete Here is my method

    function delete () {
        if(confirm('Are you SURE!')) {
        var checkedValues = $('input:checkbox:checked').map(function() {
            return this.value;
        }).get();
        $.ajax({
        type    : "POST",
        url     : "",
        data    : {ids: checkedValues, _token: ""},
        success: function(result) {
                        if(result == 'delete') {
                            window.location.href = "/school";
                        }
                    }
});
}
    }

Just I want to add new Thing here if no checkbox sleeted it should show an alert no should go on url




Aucun commentaire:

Enregistrer un commentaire