Send request to server on checkbox click

Total Post:2

Points:14
C#  Mvc  Mvc4  Razor 
C#
 356  View(s)
Ratings:
Rate this:

Hi Expert, 

I want to send request to server on chechbox click. Here is my code:

grid.Column("IsActive", header: "Is Active", style: "center_align", format: @<text><input type="checkbox" id="@item.ID" class="cheIsActive" checked="@item.IsActive" /></text>, canSort: true)

Please give me some idea..

  1. Post:44

    Points:310
    Re: Send request to server on checkbox click

    Hi JULES BOUTIN,

    Kindly use javascript code for achived your task. Call method on chechbox click.

    Please follow below line of codes:

    <script>
    
    $(function () {
    $('.cheIsActive').click(function () {
            $.post("Your path", {parameter}, function (response) {

            })
        });
    }
    </script>

    Hope this was helpful for you...

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!