Answers for "call action method on checkbox click asp.net mvc without pageload"

C#
0

call action method on checkbox click asp.net mvc without pageload

@section scripts {
    <script>
        $(function() {
            $('.toggle').change(function() {
                var self = $(this);
                var url = self.data('url');
                var id = self.attr('id');
                var value = self.prop('checked');

                $.ajax({
                    url: url,
                    data: { id: id },
                    type: 'POST',
                    success: function(response) {
                        alert(response);
                    }
                });
            });
        });
    </script>
}
Posted by: Guest on January-17-2021

Code answers related to "call action method on checkbox click asp.net mvc without pageload"

C# Answers by Framework

Browse Popular Code Answers by Language