后台传入的json数据,前端jquery如何取出所有type=1的title啊?

[{"content":"1","create_time":"2018-02-2715:31:54","id":"0a4faa259fdf4e46b7a8ee371651b0d1","state":0,"title":"1","type":1},{"content":"1","create_time":"2018-02-2715:32:17","id":"1c8f1404256a407d984e109e8117e827","state":0,"title":"1","type":1},{"content":"1","create_time":"2018-02-2717:39:08","id":"1de747cb35884682afecea7e2d2dc092","state":0,"title":"1","type":1},{"content":"1","create_time":"2018-02-2715:32:52","id":"4b4f712d995d4c66b54925a20d8d1c63","state":0,"title":"1","type":1},{"content":"3","create_time":"2018-02-2717:45:20","id":"59ceded6b3024b3b95bfb1b59619027e","state":0,"title":"3","type":1},{"content":"

??????

???

  ??

","create_time":"2018-02-2717:46:04","id":"5ad093e29a404578aa1c3b1c1fe5e477","state":0,"title":"??????","type":2},{"content":"

???

???

    ??

","create_time":"2018-02-2717:16:48","id":"6c95cfc93369474bb4f00085fe36e7d3","state":0,"title":"3","type":1},{"content":"3","create_time":"2018-02-2717:44:24","id":"81871baf05fb44b38d0dd028d91cc2dd","state":0,"title":"3","type":1},{"content":"3","create_time":"2018-02-2717:06:23","id":"98b15a3b69ea4d6db26ea76b86e6ce7a","state":0,"title":"3","type":1},{"content":"2","create_time":"2018-02-2716:46:41","id":"fe2823ef07bd48acbeadf48a6e7ff85c","state":0,"title":"2","type":1}]
哔哔one
浏览 321回答 2
2回答

ABOUTYOU

letarr=JSON.parse(result);//resultisyoutargetjsonstring;consttitles=[];arr.map(el=>{el.type==1&&titles.push(el.title)});console.log(titles);//["1","1","1","1","3","3","3","3","2"]
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript