首页 > Web开发 > 详细

在一般处理程序(ashx)中弹出js提示语

时间:2016-12-25 01:23:13      阅读:500      评论:0      收藏:0      [点我收藏+]
在提交form表单时,比如前台是$("form").submit()同步提交的时候,这个是没有回掉函数的,那么我们只能在后台提示,在前台显示,自己作为一个参考吧
  public class Script
        {
            public static void Alert(string message)
            {
                ResponseScript("alert(‘" + message + "‘);window.location = ‘弹出提示语后,点击确认跳到你想跳的页面‘;");
            }
            public static void ResponseScript(string script)
            {
                HttpContext.Current.Response.Write("<script type=\"text/javascript\">\n//<![CDATA[\n");
                HttpContext.Current.Response.Write(script);
                HttpContext.Current.Response.Write("\n//]]>\n</script>\n");
            }
        }

  

还有就是将一般处理程序默认的 //context.Response.ContentType = "text/plain";改为
            context.Response.ContentType = "text/html";

  

我们调用的时候直接:

Script.Alert("你的提示语!");

  

在一般处理程序(ashx)中弹出js提示语

原文:http://www.cnblogs.com/hbh123/p/6218671.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!