我正在爲我的社交網絡開發一個氣球通知。有2個或更多通知時,我遇到了這個錯誤。我查了jsonlint.com我的JSON響應,我在在線遇到錯誤6.json錯誤:parsererror
JSON響應:
{
"nid": "1101",
"img": "<img src=\".\/images\/icons\/he_wall_post_icon.png\">",
"notifier": "Sarah O'conner",
"url": " has commened on your <a href=\"wall_action.php?id=1463\">post<\/a>"
}{
"nid": "1100",
"img": "<img src=\".\/images\/icons\/he_wall_post_icon.png\">",
"notifier": "Sarah O'conner",
"url": " likes your <a href=\"wall_action.php?id=1463\">post<\/a>"
}
這裏是我的PHP部分:
$ret_arr = array('nid' => $nid2,'img' => $img, 'notifier' => $notifier, 'url' => $url);
echo json_encode($ret_arr);
這裏是我的JS部分:
function noob()
{
jQuery.ajax({
url: 'notifications.php?n=1',
dataType: 'json',
success: function(data){
alert('Success!');
},
error: function(requeset, textStatus, errorThrown){
alert('error:'+textStatus);
}
});
}
我該怎麼做到這一點!
謝謝你們。
哪一行是錯誤的地方? – Sarfraz 2010-07-24 08:37:56