Hello all, I am new to Web API and try to get the HREmpID from my ajax response but unfortunetly I am getting undefined.Below screen shot will provide more information in case if you need.

And in the below code is of ajax code that will get the records from the api
- $(document).ready(function () {
- var r = new Array();
- var j = -1;
- r[++j] = '
'; 'HREmpID Name Address City Action - $.ajax({
- type: "GET",
- url: "/api/EmployeeAPI/",
- success: function (result) {
- //alert(result[0]["FirstName"]);
- for (var i in result) {
- var data = result[i];
- alert(result[0]["HREmpID"]);
- r[++j] = '
'; ';- r[++j] = '
'; ';- r[++j] = data.HREmpID;
- r[++j] = '
- r[++j] = '
'; ';- r[++j] = data.FirstName + " " + data.LastName;
- r[++j] = '
- r[++j] = '
'; ';- r[++j] = data.Address;
- r[++j] = '
- r[++j] = '
'; ';- r[++j] = data.City;
- r[++j] = '
- r[++j] = '
- }
- r[++j] = '
- $("#empDetails").html(r.join(''));
- }
- });
- });

Asma KhalidPosted Dec 23, 2017, 10:24 AM
Hiten PandyaPosted Dec 23, 2017, 11:33 AM
Hiten PandyaPosted Dec 23, 2017, 9:20 AM
Asma KhalidPosted Dec 22, 2017, 2:46 PM