zoukankan      html  css  js  c++  java
  • 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;
        }

  • 相关阅读:
    论文阅读 | FIESTA: Fast IdEntification of State-of-The-Art models using adaptive bandit algorithms
    论文阅读 | Reinforced Training Data Selection for Domain Adaptation
    可以生成柱状图,曲线图,饼状图的自定义控件
    CSS 颜色代码大全
    Js操作Excel常用方法
    Javascript document对象常用的方法和属性
    event.keyCode用法及列表
    JS+正则表达式对表单的一些简单验证
    属性设置@property之retain,assign,weak,strong,copy
    iOS屏幕适配教程(手动布局和自动布局)
  • 原文地址:https://www.cnblogs.com/doosmile/p/2304775.html
Copyright © 2011-2022 走看看