You must Sign In to post a response.
  • Category: ASP.Net MVC

    Ajax call in jquery for web api

    I have developed a web application in ASP.NET MVC 2015. I have a table tblEmployee_Mast i.e. MS SQL Server. I have used entity framework for this web application.Database is developed first and I have developed models for these tables using entity framework. I want to load the employee name as per their designation.

    I have added a new controller for web api i.e. ApiController. The method in controller is as follows -
    public ActionResult Get(string id)
    tblEmployee_Mast objEmp = new tblEmployee_Mast();

    return new JsonResult()
    Data = objEmp ,

    The jquery function is as follows -
    function FillEmp()
    var strDesig = $('#ddlDesig').val();
    url: '/Api/Values/' + strDesig,type: "GET", dataType: "JSON",data:{ddlDesig:strDesig}, success: function (Emps)
    $.each(Emps, function (i, emp)
    }, error: function (Fail) { alert('Fail');}

    I can not get data in Emps
  • #767509

    Rather than check with the code just simply alert one message in success case, if the alert message trigger then recheck your code.

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

Sign In to post your comments