Я получил этот массив JSON:Получить счетчик конкретного массива из ответа JSON с помощью JQuery
{
"error":"false",
"result":{
"active_chats":{
"list":[
]
},
"closed_chats":{
"list":[
]
},
"pending_chats":{
"list":[
{
"id":"90",
"nick":"reee",
"referrer":"\/\/xyz.com\/",
"dep_id":"1",
"time_created_front":"06:26:09",
"department_name":"IT",
"wait_time_pending":"04 m. 44 s.",
"wait_time_seconds":284
},
{
"id":"89",
"nick":"admin",
"referrer":"\/\/xyz.com\/",
"dep_id":"1",
"user_closed_ts":"1441160928",
"time_created_front":"06:25:08",
"department_name":"IT",
"wait_time_pending":"05 m. 45 s.",
"wait_time_seconds":345
}
],
"nick":"reee | IT",
"msg":"dfgfg",
"last_id_identifier":"pending_chat",
"last_id":90
},
"transfer_chats":{
"list":[
],
"last_id_identifier":"transfer_chat",
"last_id":0
},
"transfer_dep_chats":{
"list":[
],
"last_id_identifier":"transfer_chat",
"last_id":0
},
"online_op":{
"list":[
{
"id":"1",
"user_id":"1",
"dep_id":"0",
"hide_online":"0",
"last_activity":"1441161046",
"last_accepted":"0",
"active_chats":"0",
"user":{
"id":"1",
"username":null,
"password":null,
"email":null,
"name":"ssseas Chat",
"filepath":null,
"filename":null,
"surname":"software",
"job_title":null,
"skype":null,
"xmpp_username":null,
"disabled":"0",
"hide_online":"0",
"all_departments":"1",
"invisible_mode":"0",
"time_zone":"Indian\/Mahe",
"rec_per_req":"0",
"session_id":"",
"lastactivity_ago":"7 s.",
"lastactivity":1441161046
}
}
]
},
"unread_chats":{
"msg":"New unread message",
"nick":"Visitor",
"last_id":0,
"last_id_identifier":"unread_chat",
"list":[
]
}
}
}
Я хотел бы подсчитать общее количество ожидающих чатов с помощью запроса Jquery.
Как я мог это сделать?
Что вы пробовали? Пожалуйста, отредактируйте свой вопрос с дополнительными деталями, например, как вы ожидали работать, и почему, поэтому мы можем помочь вам лучше. – jaggedSpire