ajax get data from database jquery code example

Example: how to get data from database using jquery ajax in asp net

function GetEmployeeUsingAjax() {
        var EmpId = 2;
        $.ajax({
            type: 'GET',
            url: '@Url.Action("GetAllUser")',
            data: { "EmpId": EmpId },
            dataType: 'json',
            success: function (data) {
                alert(data);
                //$('#id').text(emp.employee.Id);
                //$('#firstName').text(emp.employee.FirstName);
                //$('#lastName').text(emp.employee.LastName);
            },
            error: function (emp) {
                alert('error');
            }
        });
    }

       [HttpGet]
        public JsonResult GetAllUser(int EmpId)
        {
        // your code
       }

 plus string.Format("Select * From Employee where empid = {0} ",EmpId)