You can use
jQuery ajax for this.
Note:Just a guidance.Change it according to your scenario.
JS
$.ajax({
url: "/Portal/IsEmployeeExist",
type: 'Get',
dataType: "json",
cache: false,
data: { empId: passYourEmpId},
success: function (data) {
if (!data) {
}
},
error: function (xhr, ajaxOptions, thrownError) {
}
});
Action method
[HttpGet]
public JsonResult IsEmployeeExist(string empId)
{
var isEmployeeExist =
return Json(isEmployeeExist, JsonRequestBehavior.AllowGet);
}
Here is the nice Video about that : Evolving Practices in Using jQuery and Ajax in ASP.NET MVC Applications