現在、JSON を初めて使用しており、jQuery の経験はほとんどありません。$.ajax リクエストの「成功」でトリガーされるこの関数があります。
function(data) {
$.each(data.notifications, function(notifications) {
alert('New Notification!');
});
}
ただし、firebug コンソールに「オブジェクトは未定義です」「長さ = object.length」というエラーが表示されます。
JSON 応答は次のとおりです。
["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"}]]]
sの数と関係があると思い[]
ますが、JSON は json_encode() を使用して PHP によってエンコードされました
どんな助けでも大歓迎です!
ありがとう :)