码迷,mamicode.com
首页 > Web开发 > 详细

laravel后台返回ajax数据

时间:2017-07-17 12:29:15      阅读:235      评论:0      收藏:0      [点我收藏+]

标签:token   code   json   前台   time   class   log   post   cti   

后台模式:

1  $array = array(‘msg‘=>‘添加失败!‘,‘status‘=>‘false‘);
2  return json_encode($array);

前台显示:

 1  $.ajax({
 2                 url: "{{url(‘ucenter/saveTrain‘)}}",
 3                 type: "post",
 4                 dataType: "json",
 5                 data: {"content": content,"read": read,"trainer":trainer,"time1":time1,"where":where,"result":result,"score":score,‘_token‘: "{{csrf_token()}}"},
 6                 success: function (result) {
 7                    
 8                     if(result.status == ‘true‘){
 9                         layer.msg(result.msg);
10                         location.href = ‘{{url(‘ucenter/train‘)}}‘;
11                     }else{
12                         layer.msg(result.msg);
13                         return false;
14                     }
15                 },

 

laravel后台返回ajax数据

标签:token   code   json   前台   time   class   log   post   cti   

原文地址:http://www.cnblogs.com/wanlibingfeng/p/7193544.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!