I'm trying to parse the following json using jquery...
{
"notificationhistory": [
{
"userid": "Richard",
"createdtime": "2014-10-01T15:20:55",
"actiontype": "Y",
"note": "Richard test",
"actioncode": "AC",
"lastmodified": "2015-04-28T10:52:28"
}
]
}
My jquery function to try and do this looks liek this....
function loadNotificationBarData() {
var url = "json/notificationBar.action";
$.ajax({
url: url,
type: 'GET',
dataType: 'json',
success: function(data) {
var json = $.parseJSON(data);
alert(json.notificationhistory[0].actiontype);
alert(json.notificationhistory[0].actioncode);
alert(json.notificationhistory[0].note);
}
});
}
But this is not working for me. I keep getting a null for my var json.
Can someone help me with this please?
thanks