如何在FastAdmin中使用Ajax发送请求?
2021-01-24 11:12
标签:layer data add post red com public player decode html页面: 如何在FastAdmin中使用Ajax发送请求? 标签:layer data add post red com public player decode 原文地址:https://www.cnblogs.com/xieqijiang/p/13255996.htmljs文件里添加以下代码:{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(‘‘+ret["msg"]["msg"]+‘‘);
}
},
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);
}
}
上一篇:Java基础之线程1
文章标题:如何在FastAdmin中使用Ajax发送请求?
文章链接:http://soscw.com/index.php/essay/46285.html