客户端:

$.ajax(
                        {
                            type: "POST",
                            url: "SaveRole.aspx?o,

    //async: false, 同步

                            success: function(mes) {
                                if (mes != "") {

                                    if (mes == "fail") {
                                        //保持失败

                                    } else {
                                        //保存成功
                                        alert("保持成功");
                                        window.location.href = "OperatorList.aspx";
                                    }

                                } else {
                                    //$("#divResult").text("程序出错,请重新启动");
                                }
                            },
                            error: function() {
                                alert("error");
                            }
                        });

 

 

------------------------------

服务器:

 

 protected void Page_Load(object sender, EventArgs e)
        {
            string OperatorId = Request.QueryString["oid"];
            string role = Request.QueryString["role"];

            string formData1=Request.Form["formData1"];

            string formData2=Request.Form["formData2"];


            int ret = 0;
            if (string.IsNullOrEmpty(role))
            {
                ret = ServiceFactory.OperatorService.SetRole(long.Parse(OperatorId), "");
            }
            else
            {
                string[] arr = role.Split(new char[] { ',' });

                System.Text.StringBuilder sb = new System.Text.StringBuilder("");
                for (int i = 0; i < arr.Length; i++)
                {
                    if (!string.IsNullOrEmpty(arr[i]))
                        sb.AppendFormat("<cus OperatorId=\"{0}\" RoleId=\"{1}\"/>", OperatorId, arr[i]);
                }

                ret = ServiceFactory.OperatorService.SetRole(long.Parse(OperatorId), sb.ToString());
            }
            if (ret >= 0)
                Response.Write("success");
            else
                Response.Write("fail");


            Response.End();
        }

 

相关文章:

  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
  • 2021-05-17
  • 2021-11-19
猜你喜欢
  • 2021-11-15
  • 2022-01-21
  • 2022-12-23
  • 2021-08-09
  • 2021-12-16
  • 2021-11-18
相关资源
相似解决方案