Currently working for the first time with JSON and with little experience of jQuery. I have this function that gets triggered on "success" of $.ajax request:
function(data) {
$.each(data.notifications, function(notifications) {
alert('New Notification!');
});
}
However I get an error in the firebug console stating "object is undefined" "length = object.length".
The JSON response is:
["notifications",[["test would like to connect with you",{"Accept":"\/events\/index.php\/user\/connection?userId=20625101&action=accept","Decline":"\/events\/index.php\/user\/connection?userId=20625101&action=decline"}]]]
I guess it has something to do with the number of []s but the JSON was encoded by PHP using json_encode()
Any help would be appreciated!
Thanks :)