我想知道如何将所有以下数据发送到div中,因为你可以看到我已经给它一个电话并且调用了我收集了所有正确的数据,但是我的div'#s没有更新。所以它显然是客户端问题。
{{"notifications":
[
"num":"1",
"title":"681",
"url":"Lucy Botham posted a status on your wall"
"urlf":"singlepoststreamitem.php?streamitem_id=556"
"urlfy":"85"
"urlfyf":"2015-11-06 16:30:52"
},]}
{{"notifications":
[
"num":"1",
"title":"682",
"url":"Lucy Botham posted a status on your wall"
"urlf":"singlepoststreamitem.php?streamitem_id=557"
"urlfy":"85"
"urlfyf":"2015-11-06 16:30:54"
},]}
{{"notifications":
[
"num":"1",
"title":"683",
"url":"Lucy Botham posted a status on your wall"
"urlf":"singlepoststreamitem.php?streamitem_id=558"
"urlfy":"85"
"urlfyf":"2015-11-06 16:30:55"
},]}
我不会在问题上发布不相关的代码,因为我知道它只是在我遇到问题的成功。我对这种方法很陌生,所以可能会用一些评论来描述我的错误。
dataType:"json",
success: function(data){
$.each(notifications, function(i,data)
{
var div_data =
<div class='notif_text'><div id='notif_actual_text-' class='notif_actual_text'>
<img border='1' src='userimages/cropped'"+notifications[i].notification_triggeredby+"'.jpg'
onerror=this.src='userimages/no_profile_img.jpeg' width='40' height='40' ><br />
<a href=''"+notifications[i].notification_throughurl+"''>'"+notifications[i].notification_content+"'</a>
<br />'"+notifications[i].notification_time+"'<br/></div></div></div><hr/>";
if(notifications[i].notification_id>notification_id){
$(div_data).prepend("#notif_ui"+notifications[i].notification_id);
}
});
i =
parseInt($("#mes").text());$("#mes").text((i+notifications[i].num));