/* 注销用户 */
function canelUser(userId, userName){
if(confirm("您确定要注销"+userName+"吗?"))
{
$.ajax({
url:'../User/updateUser',
type:'POST',
async:true,
data:{
id:userId,
deleted:'0'
},
dataType: "json",
success:function(response){
//等于1,表示下单成功跳转到支付的Control
if('1'== response.status)
{
alert("注销"+userName+"成功!");
//需要传订单ID进入付款页面
window.location.reload();
}
//失败则弹出消息
else
{
alert("注销"+userName+"失败!");
}
}
});
}
}
/* 启用用户 */
function startUser(userId, userName){
if(confirm("您确定要启用"+userName+"吗?"))
{
$.ajax({
url:'../User/updateUser',
type:'GRT',
async:true,
data:{
id:userId,
deleted:'1'
},
dataType: "json",
success:function(response){
//等于1,表示下单成功跳转到支付的Control
if('1'== response.status)
{
alert("启用"+userName+"成功!");
//需要传订单ID进入付款页面
window.location.reload();
}
//失败则弹出消息
else
{
alert("启用"+userName+"失败!");
}
}
});
}
function canelUser(userId, userName){
if(confirm("您确定要注销"+userName+"吗?"))
{
$.ajax({
url:'../User/updateUser',
type:'POST',
async:true,
data:{
id:userId,
deleted:'0'
},
dataType: "json",
success:function(response){
//等于1,表示下单成功跳转到支付的Control
if('1'== response.status)
{
alert("注销"+userName+"成功!");
//需要传订单ID进入付款页面
window.location.reload();
}
//失败则弹出消息
else
{
alert("注销"+userName+"失败!");
}
}
});
}
}
/* 启用用户 */
function startUser(userId, userName){
if(confirm("您确定要启用"+userName+"吗?"))
{
$.ajax({
url:'../User/updateUser',
type:'GRT',
async:true,
data:{
id:userId,
deleted:'1'
},
dataType: "json",
success:function(response){
//等于1,表示下单成功跳转到支付的Control
if('1'== response.status)
{
alert("启用"+userName+"成功!");
//需要传订单ID进入付款页面
window.location.reload();
}
//失败则弹出消息
else
{
alert("启用"+userName+"失败!");
}
}
});
}
}
/* 编辑用户 */
function editUser(userId)
{
var url = "../User/getUserById";
var params = {id:userId};
var temp = document.createElement("form");
temp.action = url;
temp.method = "post";
temp.style.display = "none";
for (var x in params) {
var opt = document.createElement("input");
opt.name = x;
opt.value = params[x];
temp.appendChild(opt);
}
document.body.appendChild(temp);
temp.submit();
return temp;
}
本文介绍了一个用于管理网站用户状态的JavaScript脚本,包括注销、启用用户及编辑用户功能。通过AJAX调用后端接口实现用户状态更新,并提供确认提示和操作反馈。
&spm=1001.2101.3001.5002&articleId=71248953&d=1&t=3&u=c43cf5911a524ba4a629949971be02a2)
843

被折叠的 条评论
为什么被折叠?



