首页 课程中心 问答&分享 读书 公众号框架 HUI H.JS 开放源 登录 & 注册
 做新闻我该怎么解析json的数据
[ dczeeeee ] 发布于 : 2018-03-11  浏览 :  次
{
	"reason":"成功的返回",
	"result":{
		"stat":"1",
		"data":[
			{
				"uniquekey":"d30ab64504cb7280b7d2b81f3a0afc20",
				"title":"法印推进防务及核电合作 全球最大核电厂年底开建",
				"date":"2018-03-11 18:22",
				"category":"头条",
				"author_name":"落幕时的黄昏",
				"url":"http:\/\/mini.eastday.com\/mobile\/180311182228574.html",
				"thumbnail_pic_s":"http:\/\/07.imgmini.eastday.com\/mobile\/20180311\/20180311_afc0323a906c0a35f99446dc67ba6afe_cover_mwpm_03200403.jpg",
				"thumbnail_pic_s02":"http:\/\/07.imgmini.eastday.com\/mobile\/20180311\/20180311_871518f92b952cdc59a3c4573e791329_cover_mwpm_03200403.jpg",
				"thumbnail_pic_s03":"http:\/\/07.imgmini.eastday.com\/mobile\/20180311\/20180311_afc0323a906c0a35f99446dc67ba6afe_cover_mwpm_03200403.jpg"
			},
			{
				"uniquekey":"de0cb021f7e9fecd03100264160140f0",
				"title":"宪法新增监察委员会对反腐有何意义?法工委回应",
				"date":"2018-03-11 19:16",
				"category":"头条",
				"author_name":"海外网",
				"url":"http:\/\/mini.eastday.com\/mobile\/180311191600971.html",
				"thumbnail_pic_s":"http:\/\/03.imgmini.eastday.com\/mobile\/20180311\/20180311191600_f839a39c8269de5301cc6895bfe98cc1_1_mwpm_03200403.jpg"
			}
                        ]	
                    },
	            "error_code":0
}
这个是json返回数据,我该怎么写success时的函数得到图片和标题放在图文列表里?
function(data) {
        var html='';
	for(var i = 0; i < data.length(这里也不清楚); i++) {
		html += '<li>' +
		'<a href="javascript:hui.toast(\'hi...\');">' +
		'
<img src="' + 这里写什么获取图片+'" />
' + '
' + '<h1>' + 这里写什么获取标题+'</h1>' + '
' + '</a>' + '</li>'; } hui('#topList').html('<ul>'+html+'</ul>'); }


教程更新
More...