zoukankan      html  css  js  c++  java
  • 如何在FastAdmin中使用Ajax发送请求?

    html页面:

    js文件里添加以下代码:{field: 'uid', title: __('解绑'), table: table, buttons: [
    {
    name: 'ajax',
    text: __('解绑'),
    title: __('解绑'),
    classname: 'btn btn-xs btn-success btn-magic btn-ajax',
    icon: 'fa fa-magic',
    url: 'player/player/unbundling?',
    confirm: '确认是否要解绑',
    success: function (data, ret) {
    if(ret["msg"]["code"]==200){
    Layer.alert("解绑"+ret["msg"]["msg"]);
    }
    else {
    Layer.alert('<span id="" style="color: red;">'+ret["msg"]["msg"]+'</span>');
    }
    },
    error: function (data, ret) {
    console.log(data, ret);
    Layer.alert(ret.msg);
    return false;
    }
    }
    ], operate:false, formatter: Table.api.formatter.buttons},

    后台代码如下:
    public function addRoomCardSave(){
    $uid = $_POST["uid"];
    $num = $_POST["num"];
    $result = $this->commonFun($uid,$num);
    if(!$result){
    return $this->success("请求失败,服务器error");
    }
    else{
    $res = json_decode($result,true);
    return $this->success($res);
    }
    }
  • 相关阅读:
    php上传excle文件,csv文件解析为二维数组
    transition的使用
    数组
    快捷键
    SCSS历史介绍与配置
    18-async函数
    this的指向问题
    媒体查询
    13-Set和Map数据结构
    15-Iterator和for…of循环
  • 原文地址:https://www.cnblogs.com/xieqijiang/p/13255996.html
Copyright © 2011-2022 走看看