后台利用JS刷新页面(网站)

1.在后台中的显示添加或修改后的提示信息(提示之后刷新当前页)

ShowMsgHelper.AlertMsg("操作成功!");

2.提示信息的原函数

  top.main.windowload();//javascript中的刷新页面代码

  public static void AlertMsg(string message)
        {
            ShowMsgHelper.ExecuteScript(string.Format("showTipsMsg('{0}','2500','4');top.main.windowload();OpenClose();", message));
        }

3.将后台的代码反应到前台的JS代码中

 public static void ExecuteScript(string scriptBody)
        {
            string scriptKey = "Somekey";
            Page p = HttpContext.Current.Handler as Page;
            p.ClientScript.RegisterStartupScript(typeof(string), scriptKey, scriptBody, true);
        }

4.FunctionJS.js中的相关代码

//回调
function windowload() {
    rePage();
}
/**
刷新页面
**/
function rePage() {
    Loading(true);
    window.location.href = window.location.href.replace('#', '');
    return false;
}
/**
短暂提示
msg: 显示消息
time:停留时间ms
type:类型 4:成功,5:失败,3:警告
**/
function showTipsMsg(msg, time, type) {
    top.ZENG.msgbox.show(msg, type, time);
}



  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值