Skip to content Skip to sidebar Skip to footer

How To Update Database Without Refreshing The Page Asp.net

We are creating a simple application using ASP.NET MVC. The app is all about uploading pictures and rating it, we have two buttons to vote, 'like' and 'dislike' Each time I click

Solution 1:

Click a button, pass a variable and post to your method using ajax.

Something like this should get your started:

<buttonvalue="1">Like</button><buttonvalue="-1">Dislike</button><Script>
    $("button").click(function(){
        var xButtonValue = $(this).val();
        $.post("YourController.whatever",
        {
            value: xButtonValue,
        },
        function(data, status){
            alert("Data: " + data + "\nStatus: " + status);
        });
    });
</Script>

Post a Comment for "How To Update Database Without Refreshing The Page Asp.net"