114 lines
3.7 KiB
JavaScript
114 lines
3.7 KiB
JavaScript
|
||
//添加会员
|
||
$("#btnaddUser").click(function () {
|
||
|
||
var btnText = $('#btnaddUser').html()
|
||
$("#btnaddUser").attr("disabled", "true"); //设置禁用按钮
|
||
$('#btnaddUser').text('提交中...'); //显示提交中
|
||
|
||
$("#addUserForm").ajaxSubmit({
|
||
url: "/APP/Fuser/addUser",
|
||
type: "post",
|
||
success: function (res) {
|
||
if (res.Status == 200) {
|
||
$.toastr.success('添加成功',
|
||
{
|
||
position: 'top-center',
|
||
time: 2000,
|
||
callback: function () {
|
||
location.href = "/APP/Fuser/addUser";
|
||
}
|
||
});
|
||
|
||
} else {
|
||
|
||
$.toastr.error('添加失败! <br />' + res.Message, {
|
||
time: 3000,
|
||
position: 'top-center'
|
||
});
|
||
|
||
$('#btnaddUser').removeAttr('disabled')//重置按钮
|
||
$('#btnaddUser').text(btnText); //还原显示
|
||
}
|
||
},
|
||
error: function (error) {
|
||
$('#btnaddUser').removeAttr('disabled')//重置按钮
|
||
$('#btnaddUser').text(btnText); //还原显示
|
||
alert(error);
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
//会员详情
|
||
function userDetails(id) {
|
||
|
||
// Ajax提交数据
|
||
$.ajax({
|
||
url: "/App/Fuser/modifyUser",//@Url.Action("GetDataqueryDetails", "ConditionQuery")",//"APP/login/login", // 提交到controller的url路径
|
||
type: "get", // 提交方式
|
||
data: { "ID": id }, // data为String类型,必须为 Key/Value 格式。
|
||
//dataType: "json", // 服务器端返回的数据类型
|
||
success: function (res) { // 请求成功后的回调函数,其中的参数data为controller返回的map,也就是说,然后通过data这个参数取JSON数据中的值
|
||
$("#userDetailsBox").html(res);
|
||
//$.toastr.success('添加成功');
|
||
},
|
||
|
||
});
|
||
};
|
||
//添加管理员
|
||
function userDetailss() {
|
||
|
||
// Ajax提交数据
|
||
$.ajax({
|
||
url: "/App/Fuser/addUser",//@Url.Action("GetDataqueryDetails", "ConditionQuery")",//"APP/login/login", // 提交到controller的url路径
|
||
type: "get", // 提交方式
|
||
success: function (res) { // 请求成功后的回调函数,其中的参数data为controller返回的map,也就是说,然后通过data这个参数取JSON数据中的值
|
||
$("#userDetailsBox").html(res);
|
||
|
||
},
|
||
|
||
});
|
||
};
|
||
|
||
|
||
//修改会员
|
||
$("#btnModifyUser").click(function () {
|
||
|
||
var btnText = $('#btnModifyUser').html()
|
||
$("#btnModifyUser").attr("disabled", "true"); //设置禁用按钮
|
||
$('#btnModifyUser').text('提交中...'); //显示提交中
|
||
|
||
$("#modifyUserForm").ajaxSubmit({
|
||
url: "/APP/user/ModifyUser",
|
||
type: "post",
|
||
success: function (res) {
|
||
if (res.Status == 200) {
|
||
$.toastr.success('修改成功',
|
||
{
|
||
position: 'top-center',
|
||
time: 2000,
|
||
callback: function () {
|
||
location.href = "/APP/User/UserList";
|
||
}
|
||
});
|
||
|
||
} else {
|
||
|
||
$.toastr.error('添加失败! <br />' + res.Message, {
|
||
time: 3000,
|
||
position: 'top-center'
|
||
});
|
||
$('#btnModifyUser').text(btnText); //还原显示
|
||
$('#btnModifyUser').removeAttr('disabled')//重置按钮
|
||
|
||
}
|
||
},
|
||
error: function (error) {
|
||
$('#btnModifyUser').removeAttr('disabled')//重置按钮
|
||
$('#btnModifyUser').text(btnText); //还原显示
|
||
alert(error);
|
||
}
|
||
});
|
||
|
||
}); |