Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

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>
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #call #action #method #checkbox #click #mvc #pageload
ADD COMMENT
Topic
Name
7+4 =