Hi, I think you must first learn 'JavaScript' or 'JQuery'. And also learn AJAX, as it is frequently used in the MVC.
var a = document.getElementById("variableID").value;
$.ajax({
url: "/ControllerName/ActionName",
data: {a},
dataType: "JSON",
type: "POST",
error: function (jxr, status, error) {
HandleAjaxError(jxr, status, error);
},
success: function (data) {
var sReturn = data;
if (sReturn == 1) {
alert('Your Message');
}
else {
alert('Your Message');
}
}
});
Place below code above the controller action defination, which you will call through AJAX. It specifies that particular action is for 'POST'.
[HttpPost]
public ActionResult ActionName{}
{
}