1 function GetEmployeeUsingAjax() {
2 var EmpId = 2;
3 $.ajax({
4 type: 'GET',
5 url: '@Url.Action("GetAllUser")',
6 data: { "EmpId": EmpId },
7 dataType: 'json',
8 success: function (data) {
9 alert(data);
10 //$('#id').text(emp.employee.Id);
11 //$('#firstName').text(emp.employee.FirstName);
12 //$('#lastName').text(emp.employee.LastName);
13 },
14 error: function (emp) {
15 alert('error');
16 }
17 });
18 }
19
20 [HttpGet]
21 public JsonResult GetAllUser(int EmpId)
22 {
23 // your code
24 }
25
26 plus string.Format("Select * From Employee where empid = {0} ",EmpId)