js和thinkphp5路由拼接一个实例

 1      $.ajax({
 2             type:"get",
 3             dataType:"json",
 4             url:"/home/index/ajax_page_data/cate_id/{$cate_id}/page/"+(++page),
 5             success:function(data){
 6              if(data.nodata!=1){
 7                   var result ='<div class="row">';
 8                   for ( var i = 0; i <data.length; i++) {
 9                      result += ''
10                             + '    <div class="col s6">'
11                             + '        <a href="{:url('home/index/info')}/id/'+data[i].id+'">'    -->亮点在这
12                             + '        <div class="shop">'
13                             + '            <img src="'+data[i].video_thumb+'" class="lists_img" alt="">'
14                             + '            <h6><a href="{:url('home/index/info')}/id/'+data[i].id+'">'+data[i].title+'</a></h6>'
15                             + '            <span>2017-06-06</span>'
16                             + '        </div>'
17                             + '        </a>'
18                             + '    </div>'
19                     }
20                         result+= '</div>';
21                    $(".up:last-child").append(result);
22              }else{
23                  alert("没有更多数据");
24              }
25             }
26         });

 

posted @ 2017-07-01 23:42  叫我星宇  阅读(215)  评论(0编辑  收藏  举报