欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

在一般處理程序(ashx)中彈出js提示語

 更新時(shí)間:2017年08月16日 09:03:32   投稿:mrr  
這篇文章主要介紹了在一般處理程序(ashx)中彈出js提示語的相關(guān)資料,需要的朋友可以參考下

在提交form表單時(shí),比如前臺(tái)是$("form").submit()同步提交的時(shí)候,這個(gè)是沒有回掉函數(shù)的,那么我們只能在后臺(tái)提示,在前臺(tái)顯示,自己作為一個(gè)參考吧

public class Script
   {
     public static void Alert(string message)
     {
       ResponseScript("alert('" + message + "');window.location = '彈出提示語后,點(diǎn)擊確認(rèn)跳到你想跳的頁面';");
     }
     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");
     }
   }

還有就是將一般處理程序默認(rèn)的 //context.Response.ContentType = "text/plain";改為
            context.Response.ContentType = "text/html";  

我們調(diào)用的時(shí)候直接: 

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

PS:Js中$.ajax調(diào)用一般處理程序(.ashx)

$.ajax({
          type: "post",
          url: "/tools/ActApply.ashx",
          data: "txthdmoney=" + $.trim($("#hdmoneyx")[0].value)+"&sxf=2",
          success: function (result) {            
          }
        });

.ashx后臺(tái)接收數(shù)據(jù)

  protected decimal hdmoney;
    protected decimal hdsxf;
    /// <summary>
    /// 請(qǐng)求處理
    /// </summary>
    /// <param name="context"></param>
    public void ProcessRequest(HttpContext context)
    {
      Withdrawal withdra = new Withdrawal();
      context.Response.ContentType = "text/plain";
      hdmoney = Convert.ToDecimal(context.Request.Params["txthdmoney"].ToString());
      hdsxf = Convert.ToDecimal(context.Request.Params["sxf"].ToString());
      SaveAct();
    }
    public bool IsReusable
    {
      get
      {
        return false;
      }
    }

總結(jié)

以上所述是小編給大家介紹的在一般處理程序(ashx)中彈出js提示語,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論