console.log($(this).children(‘input‘).val());
console.log($(this).children(‘#ha‘).val());
var id = $(this).children(‘input‘).val();
$.ajax({
type:"GET",
url:"/api/index/index",
dataType:"json",
data:{
id:id,
},
success:function(data){
var arr = data.data;
for(var i=0;i<arr.length;i++){
console.log(arr[i]);
console.log(arr[i][‘content‘]);
// var hu = arr[i][‘content‘];
$("#qing .liang").append(" <li>\n" +
" <a href=\"/show-13-671.html\">\n" +
" <div class=\"img\">\n" +
" <img src=\"__STATIC__/index/images/p1.jpg\" alt=\"\" srcset=\"\">\n" +
" </div>\n" +
" <div class=\"cont\">\n" +
"\n" +
" <h3>"+arr[i][‘title‘]+"</h3>\n" +
" <span> </span>\n" +
" <p></p>\n" +
" </div>\n" +
" </a>\n" +
" </li>");
// arr[i] = arr[i]/2.0;
}
}});
ajax 请求接口 返回值 在前台循环