Hello Everyone,
Below is my Webmethod
[WebMethod]
public void GetAllEmployee(string month, string year)
{
try
{
DBHelper oDBhelper = new DBHelper();
DataTable dt = new DataTable();
List<EmployeeWithOCBalance> employeelist = new List<EmployeeWithOCBalance>();
Hashtable param = new Hashtable();
param.Add("@Case ", 3);
param.Add("@bmonth", month);
param.Add("@byear", year);
dt = oDBhelper.GetDatatabel("usp_OC_balance_details", param);
for (int i = 0; i < dt.Rows.Count; i++)
{
EmployeeWithOCBalance employee = new EmployeeWithOCBalance();
employee.emp_id = dt.Rows[i]["emp_id"].ToString();
employee.name = dt.Rows[i]["name"].ToString();
employee.opening_balance = dt.Rows[i]["opening_balance"].ToString();
employee.closing_balance = dt.Rows[i]["closing_balance"].ToString();
employeelist.Add(employee);
}
JavaScriptSerializer js = new JavaScriptSerializer();
Context.Response.Write(js.Serialize(employeelist));
}
catch (Exception ex)
{
}
}
And this is my Ajax method
function BindEmployees(month,year) {
$.ajax({
url: 'Assets.asmx/GetAllEmployee',
data: '{ "month": "'+month+'", "year": "'+year+'" }',
dataType: "json",
method: 'POST',
contentType: 'application/json',
success: function (data) {
.......................... so on
I am getting method repose code as 200.
When I get the json response, it adds {"d":null} at the very last.
I don't know from where it is coming.
The result is I am not able to bind the data in a table.
Kindly suggest.
Thanks