jquery例子

 TEXT:

 

<%@ WebHandler Language="C#" Class="userHandler" %>

using System;
using System.Web;

public class userHandler : IHttpHandler {
   
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        //context.Response.Write("Hello World");
        string action = context.Request.Form["act"] != null ? context.Request.Form["act"].ToString() : string.Empty;
       // string superid = context.Session["id"] != null ? context.Session["id"].ToString() : string.Empty;
        switch (action)
        {
              
            case "refuseapp":
                string id = context.Request.Form["id"] != null ? context.Request.Form["id"].ToString() : string.Empty;
                Wangzhi.Bll.AddMoBll ab = new Wangzhi.Bll.AddMoBll();
                int ii = ab.UpdateForPay1(int.Parse(id));
                context.Response.Write(ii.ToString ());
                //if (ab.UpdateForPay1(int.Parse(id ))==1)
                //    context.Response.Write("1");
                //else
                //    context.Response.Write("0");
                break;
            default:
                break;
        }
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}

 

<script type="text/javascript">
        function ref(ad_id)
        {
            if (!confirm('确定要付款吗?'))
                return ;                          
            $.post(
               'userHandler.ashx',
               {act:'refuseapp',id:ad_id},
               function (data,textStatus)
               {
                    if (data == '1')
                    {alert('续费支付成功!');window.location.href = window.location.href;}
                    else if(data=="2")
                    alert('网站尚未开通,无法续费');
                    else if(data=="3")
                    alert('网站已经开通,无须再开通');
                    else if(data=="4")
                    {
                    alert('网站开通申请付费成功!');
                    //top.loginout();
                    //top.location.href='';
                    }
                    else if(data=="5")
                    alert('试用无须付费');
                    else if(data=="6")
                    alert('支付失败');
                    else if(data=='0')
                        alert('您的帐户余额不足,操作失败');
                        else
                        alert('出现未知错误');              
               },
               'text'
            );
        }
    </script>

你可能感兴趣的:(jquery)