i'm trying parse 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 try , 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 not working me. keep getting null var json.
can me please?
thanks
unless i'm mistaken, jquery $.ajax
parses data json
automatically you, remove var json = $.parsejson(data);
code not needed