how to get data from database using jquery ajax in asp net 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);
},
error: function (emp) {
alert('error');
}
});
}
[HttpGet]
public JsonResult GetAllUser(int EmpId)
{
}
plus string.Format("Select * From Employee where empid = {0} ",EmpId)