为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

幕布斯6054654 2019-03-13 18:33:50
[{"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}]
查看完整描述

3 回答

?
大话西游666

TA贡献1817条经验 获得超14个赞

不渲染它不就好了


查看完整回答
反对 回复 2019-03-18
?
慕侠2389804

TA贡献1719条经验 获得超6个赞

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"]


查看完整回答
反对 回复 2019-03-18
?
小唯快跑啊

TA贡献1863条经验 获得超2个赞

https://img1.sycdn.imooc.com//5c8f4ac10001f33707300198.jpg

查看完整回答
反对 回复 2019-03-18
  • 3 回答
  • 0 关注
  • 775 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信