• 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;
        }

  • 相关阅读:
    CentOS6下OpenLDAP+PhpLdapAdmin基本安装及主从/主主高可用模式部署记录
    Curl运维命令
    kafka 基础知识梳理及集群环境部署记录
    RocketMQ 简单梳理 及 集群部署笔记
    Redis哨兵模式(sentinel)学习总结及部署记录(主从复制、读写分离、主从切换)
    Redis+Keepalived高可用环境部署记录
    Centos下Nodejs+npm环境-部署记录
    基于Ping和Telnet/NC的监控脚本案例分析
    linux dig 命令使用方法
    dnsjava usage
  • 原文地址:https://www.cnblogs.com/doosmile/p/2304775.html
Copyright © 2020-2023  润新知