View (Razor)
<fieldset>
<legend>Add Comment</legend>
@Html.Label(“txtComment”)
<p>
<input type=”button” onclick=”SaveComment()” value=”Save” />
</p>
</fieldset>
Javascript (Jquery Ajax Call)
function SaveComment() {
var objData = new Object();
objData.HKID = $(“#hdnHidden”).val();
objData.Comment = $(“#txtComment”).html();
$.ajax({
cache: false,
type: “POST”,
url: “/hisab/UpdateComment/”,
data: objData
}).done(function (data) {
alert(data);
}).error(function (err) {
alert(“err”);
});
}
C# Model
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace HisabKitab.Models
{
public class DailyHisab
{
public int HKID { get; set; }
public string Comment { get; set; }
public bool Status { get; set; }
}
}
C# Controller
[HttpPost]
public void UpdateComment(DailyHisab DH)
{
Response.Write(“Update Succesfully”);
}