首页 > 代码库 > js和thinkphp5路由拼接一个实例

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="http://www.mamicode.com/{:url(‘home/index/info‘)}/id/‘+data[i].id+‘">‘    -->亮点在这
12                             + ‘        <div class="shop">‘
13                             + ‘            <img src="http://www.mamicode.com/‘+data[i].video_thumb+‘" class="lists_img" >‘
14                             + ‘            <h6><a href="http://www.mamicode.com/{: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         });

 

js和thinkphp5路由拼接一个实例