AJAX请求

一、请求本页面后台【无刷新删除Repeater中的数据】:

1)、前台

<input type="button" value="删除" οnclick="del(this,<%# Eval("id")%>)" />

。。。。。。。。

function del(obj, id) {
            if (confirm("确认要删除吗?")) {
                var merchantid = $("#HiddenField1").val();
                $.ajax({
                    url: "MerchantDetail.aspx",
                    data: { callback: 1, Mid: id, id: merchantid },
                    type: "POST",
                    async: true,
                    cache: false,
                    success: function (msg) {
                        if (msg > 0) {
                            alert("删除成功");
                            $(obj).parent().parent().remove();
                        }
                    }

                })
            }
        }

后台:请求其他页面

if (!IsPostBack)
            {

                if (!string.IsNullOrEmpty(Request.Params["callback"]))
                {
                    action = Request.Params["callback"];
                    int id = StringPlus.StrToInt(Request.Params["Mid"], 0);
                    Response.Write(DelAirCompany(id));
                    Response.End();
                }
            }

二、

前台【get请求(其他页面)】

<input type="button" value="编辑" οnclick="edit(this,<%# Eval("id")%>,'<%# Eval("FMAAirCode")%>','<%# Eval("FAMAgencyFee")%>','<%# Eval("FMAReward")%>','<%# Eval("FMABillFee")%>','<%# Eval("FMARebeat")%>')" />

。。。。。。。。

function edit(obj, id, airCode, agencyFee, reward, billFee,rebeat) {
            var merchantId = $("#HiddenField1").val();
            var params = "&Mid=" + id + "&aircode=" + airCode + "&agencyfee=" + agencyFee + "&reward=" + reward + "&billfee=" + billFee + "&rebeat=" + rebeat;
            window.open('AddAirCompany.aspx?callback=2&id=' + merchantId + params, '', 'height=400,width=600,top=100,left=200,toolbar=no,location=no,status=no');
            return false;

 

后台:

string action = Request["callback"];

if (!IsPostBack)
        {

            if (action == "2")
            {
                //txtAirCode.Value =Request["aircode"].ToString();
                ddlAirCode.SelectedValue = Request["aircode"].ToString();
                txtAgencyFee.Value = StringPlus.DecToFormartDecimal(TypeParse.StrToDecimal(Request["agencyfee"].ToString(), 0.00M)).ToString();
                txtBillFee.Value = StringPlus.DecToFormartDecimal(TypeParse.StrToDecimal(Request["billfee"].ToString(), 0.00M)).ToString();
                txtReward.Value = StringPlus.DecToFormartDecimal(TypeParse.StrToDecimal(Request["reward"].ToString(), 0.00M)).ToString();
                txtRebeat.Value = StringPlus.DecToFormartDecimal(TypeParse.StrToDecimal(Request["rebeat"].ToString(), 0.00m)).ToString();
            }

}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值