1. 首页
  2. 数据库
  3. 其它
  4. Ajax返回的json遍历取值并显示到前台的方法

Ajax返回的json遍历取值并显示到前台的方法

上传者: 2021-02-24 03:01:45上传 PDF文件 29.44KB 热度 12次
使用$.each(data,function(i,n){}); 可以用n.字段,取到想要的值。 $.ajax({ type: 'post', url: '/XXX', dataType: 'json', success:function(data){ var item; $.each(data,function(i,result){ item= +result['name']++result['age']+; $('.table').append(item); }); }, }); 然后将item打入table里 <ta
下载地址
用户评论