猿问

ajax请求,后台返回的json,如何循环取出里面所有的title啊?

[{"content":"1","create_time":"2018-02-27 15:31:54","id":"0a4faa259fdf4e46b7a8ee371651b0d1","state":0,"title":"1","type":1},{"content":"1","create_time":"2018-02-27 15:32:17","id":"1c8f1404256a407d984e109e8117e827","state":0,"title":"1","type":1},{"content":"1","create_time":"2018-02-27 17:39:08","id":"1de747cb35884682afecea7e2d2dc092","state":0,"title":"1","type":1},{"content":"1","create_time":"2018-02-27 15:32:52","id":"4b4f712d995d4c66b54925a20d8d1c63","state":0,"title":"1","type":1},{"content":"3","create_time":"2018-02-27 17:45:20","id":"59ceded6b3024b3b95bfb1b59619027e","state":0,"title":"3","type":1},{"content":"<p>??????</p><p>???</p><p>&nbsp; &nbsp;??</p>","create_time":"2018-02-27 17:46:04","id":"5ad093e29a404578aa1c3b1c1fe5e477","state":0,"title":"??????","type":2},{"content":"<p>???</p><p>???</p><p>&nbsp; &nbsp; &nbsp; &nbsp;??</p>","create_time":"2018-02-27 17:16:48","id":"6c95cfc93369474bb4f00085fe36e7d3","state":0,"title":"3","type":1},{"content":"3","create_time":"2018-02-27 17:44:24","id":"81871baf05fb44b38d0dd028d91cc2dd","state":0,"title":"3","type":1},{"content":"3","create_time":"2018-02-27 17:06:23","id":"98b15a3b69ea4d6db26ea76b86e6ce7a","state":0,"title":"3","type":1},{"content":"2","create_time":"2018-02-27 16:46:41","id":"fe2823ef07bd48acbeadf48a6e7ff85c","state":0,"title":"2","type":1}]

幕布斯6054654
浏览 776回答 3
3回答

大话西游666

不渲染它不就好了

慕侠2389804

let arr = JSON.parse(result); // result is you target json string;const titles = arr.map(el => el.title);console.log(titles); // ["1", "1", "1", "1", "3", "??????", "3", "3", "3", "2"]

小唯快跑啊

随时随地看视频慕课网APP

相关分类

JavaScript
我要回答