please use [httppost] attibute on that action.
you are passing different data like this
data: {
id: id,
name: name,
email: email,
subject: subject,
message: message,
},
so it is basically looking for method which have these paramenter..
and ur action has only contact object as parameter.
better
var data0 = {
name: $("#contact-name").val(),
email:$("#contact-email").val(),
subject:$("#contact-Subject").val(),
contact:$("#contact-Message").val(),
id:$("#contact-id").val()};
var jsonContact = JSON2.stringify(data0);
$.ajax({
url:"Home/AddContact",
type: 'POST',
data: {MContact :jsonContact},
success: function (result) {
if (result.success) {
alert();
$("#contact-name").val("");
$("#contact-email").val("");
$("#contact-Subject").val("");
$("#contact-Message").val("");
$("#contact-id").val(0);
}
else {
}
},
error: function (result) {
console.log("In Error");
}
})
and your action should be like
public ActionResult AddContact(MContact mc)
{
try
{
var data = bal.addcontact(mc, id);
Result.Success = true;
Result.Data = data;
}
catch (Exception)
{
Result.Success = false;
Result.Message = "Data Not Insert";
}
return Json(Result,JsonRequestBehavior.AllowGet);
}