• ajax调用实例


    function calculateIntegral() {
        var GPrice = document.getElementById("GiftMoeny").value;
        var CPrice = document.getElementById("CodeMoeny").value;
        var freight = document.getElementById("Shopfreight").value;
        $.ajax({
            type: "POST",
            url: "../Controller/UserCart/SubmitOrder.ashx",
            data: { HttpType: "UserJifenDikou", GiftPrice: GPrice, CardPrice: CPrice, Orderfreight: freight },
            cache: false, //设置时候从浏览器中读取 缓存  true 表示 是
            datatype: "json",
            success: function (data, status) {
                if (data != "") {
                    data = eval("(" + data + ")");
                    $("#IntegralMoeny").attr("value", data.ds[0].IntegralMoeny); //赋值积分抵扣金额
                    $("#lblJifenMoney").html(data.ds[0].IntegralMoeny);
                }
                TotalOrder();
            }
        });

    }

    public void ProcessRequest(HttpContext context)
        {
            string Type = context.Request.Form["HttpType"];

            if (Type == "UserJifenDikou")
            {
                string GiftPrice = context.Request.Form["GiftPrice"];
                string CardPrice = context.Request.Form["CardPrice"];
                string Orderfreight = context.Request.Form["Orderfreight"];

                context.Response.Write(IsIntegralAll(Convert.ToDecimal(GiftPrice), Convert.ToDecimal(CardPrice), Convert.ToDecimal(Orderfreight)));
            }
        }

        public string IsIntegralAll(decimal cartprice, decimal codePrice, decimal Orderfreight)
        {
            string strhtmldate = "";
            ShopCartHelp Help = new ShopCartHelp();
            decimal ShopMeony = Help.GetShopPrice();
            //如果用户可抵扣的金额大于剩余金额
            if (Help.UserIntegralMoeny() >= ShopMeony)
            {
                strhtmldate = "{\"ds\":[{\"IntegralMoeny\":" + ShopMeony + ",\"OrderMoeny\":\"" + Orderfreight + "\"}]}";
            }
            else
            {
                decimal OrderMoeny = 0;// dikouMoney - Help.UserIntegralMoeny();
                strhtmldate = "{\"ds\":[{\"IntegralMoeny\":" + Help.UserIntegralMoeny() + ",\"OrderMoeny\":\"" + OrderMoeny + "\"}]}";
            }
            return strhtmldate;
        }

  • 相关阅读:
    finalShell 文件上传拖拽失败
    centos6.x 启动docker报错
    笔记本查看当前登录用户
    保存文件到D盘时显示“你没有权限在此文件夹中保存文件,请联系管理员“其他文件夹正常?
    关于MongoDB配置文件的一个小细节
    ubuntu: mongoDB安装,无需下载
    Java 连接虚拟机中MongoDB 所需依赖
    信息知识竞赛刷题助手
    python超多常用知识记录
    python字典键或值去重
  • 原文地址:https://www.cnblogs.com/doosmile/p/2304775.html
Copyright © 2020-2023  润新知