Below is my Json Data received from Ajax response.
{
"error": {
"errorCode": "0001",
"errorText": "SUCCESS"
},
"responselist": [
{
"count": 2,
"event": [
{
"startDate": null,
"eventId": 1234,
"eventName": "Interview",
"modifiedUser": "User",
"eventTypeCode": "1",
"eventVenue": null,
"eventSpecialInst": "isnsdf",
"eventStatusCode": "OP",
"eventLangCode": "
Eng",
"eventDesc": "sdfsadfsd",
"fromEmailId": "
[email protected]",
"rsvpDeadline": 5,
"canceledInd": "yes",
"canceldEmailText": "sdfasdfasdfasfasdfasdfasdf",
"daysToWaitlistLastCall": 5,
"daysToReminderAdmin": 6,
"daysToReminderEvent": 3,
"daysToReminderInvitation": 2,
"endDate": null,
"venueAddrLine1": null,
"venueAddrLine2": null,
"venueAddrLine3": null,
"cityCode": null,
"stateCode": null,
"appId": null,
"modifiedDate": "2010-12-16",
"countryCode": null,
"zipCode": null,
"user_id": null,
"updateFlag": "R"
},
{
"startDate": null,
"eventId": 4321,
"eventName": "Seasonal Hiring",
"modifiedUser": "User",
"eventTypeCode": "1",
"eventVenue": null,
"eventSpecialInst": "isnsdf",
"eventStatusCode": "OP",
"eventLangCode": "
Eng",
"eventDesc": "sdfsadfsd",
"fromEmailId": "
[email protected]",
"rsvpDeadline": 5,
"canceledInd": "yes",
"canceldEmailText": "sdfasdfasdfasfasdfasdfasdf",
"daysToWaitlistLastCall": 5,
"daysToReminderAdmin": 6,
"daysToReminderEvent": 3,
"daysToReminderInvitation": 2,
"endDate": null,
"venueAddrLine1": "KFC",
"venueAddrLine2": "The Forum",
"venueAddrLine3": "Koramangala",
"cityCode": "Bangalore",
"stateCode": "Karnataka",
"appId": null,
"modifiedDate": "2010-12-16",
"countryCode": "India",
"zipCode": "560040",
"user_id": null,
"updateFlag": "R"
}
]
}
]
}
Using below code to extract information inside event object. But I am not able to do it. Need guidance.
$.ajax({ url:"<%=request.getContextPath()%>/service/showInvitedEvents/21",
dataType:"json",
success: function(jsonData)
{
alert("Inside response success");
$.each(jsonData.responselist.event,function(i,item)
$.each(Employees,function(i,item)
{
alert('Iteration is' + i);
var teventName = item.eventName;
var teventVenue = item.eventVenue;
var tstartDate = item.startDate;
var tendDate = item.endDate;
var tstarend = tstartDate +" - "+ tendDate ;
$("#eventTable tbody").append("<tr><td><a id="+teventName+i+" href=<%=request.getContextPath()%>/service/session/1234>"+teventName+"</a></td><td>"+teventVenue+"</td><td>"+tstarend+"</td></tr>");
});