Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays 收集json数据并输出到AJAX div_Arrays_Json_Ajax_Function - Fatal编程技术网

Arrays 收集json数据并输出到AJAX div

Arrays 收集json数据并输出到AJAX div,arrays,json,ajax,function,Arrays,Json,Ajax,Function,我想知道如何将下面的所有数据发送到div中,正如您所看到的,我已经尝试了,并且打了电话,我收集了所有正确的数据,但是我的div没有更新。因此,这显然是一个客户端问题 {{"notifications": [ "num":"1", "title":"681", "url":"Lucy Botham posted a status on your wall" "urlf":"singlepoststreamitem.php?streamitem_id=556" "urlfy":"85" "urlf

我想知道如何将下面的所有数据发送到div中,正如您所看到的,我已经尝试了,并且打了电话,我收集了所有正确的数据,但是我的div没有更新。因此,这显然是一个客户端问题

{{"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)); 
dataType:“json”,
成功:功能(数据){
$。每个(通知、功能(i、数据)
{
var div_数据=


“+通知[i]。通知时间+”

”; 如果(通知[i]。通知\u id>通知\u id){ $(div_data).prepend(“#notif_ui”+通知[i]。通知id); } }); i= parseInt($(“#mes”).text();$(“#mes”).text((i+通知[i].num));
如果是有效的JSON,这确实是可能的……而且似乎与您的代码尝试和无效JSON中的值没有任何联系?完全不同的属性名称,因此如何知道将每个项目放在哪里?对于初学者,您错过了开头“在div_data=我是否有可能得到一些关于如何实际操作的帮助?请。谢谢