<script type="text/javascript">
    function sendpost2() {
        var shoujihaoma = document.getElementById("Mobphone").value;
        var phone = md5();//MD5加密
        var app_idi = "2B3D396DBD874913BA0EBCF4E04E394A";
        var qian = jine();//获取金额
      $.ajax({
            type: "post",
            async: false,
            url: "http://192.168.10.191:8078/recharge/getpostorder.ashx",
            dataType: "jsonp",
            data: { "app_id": app_idi, "phone": shoujihaoma,"amount":qian,"secret_code":phone },
            jsonp: "callback", //传递给请求处理程序或页面的,用以获得jsonp回调函数名的参数名(一般默认为:callback)
            jsonpCallback: "flightHandler", //自定义的jsonp回调函数名称,默认为jQuery自动生成的随机函数名,也可以写"?",jQuery会自动为你处理数据
            success: function(json) {
            alert(json.appid);
            var dingdanNum = json.appid;//获取接口的返回值,返回值的格式是变量为appid才可以
          location.href = "confirmed.html?liushui=" + dingdanNum + "&shoujiNum=" + shoujihaoma + "&monery=" + qian;
            },
            error: function() {
                alert('fail');
            }
        });
    }
     </script>

 

 

<script type="text/javascript">
    function sendget2() {
        var shoujihaoma = document.getElementById("Mobphone").value;
        var phone = md5();
        var app_idi = "2B3D396DBD874913BA0EBCF4E04E394A";
        var qian = jine();
        $.ajax({
            type: "get",
            async: false,
            url: "http://192.168.10.191:8078/recharge/getpostorder.ashx",
            dataType: "jsonp",
            data: { "app_id": app_idi, "phone": shoujihaoma, "amount": qian, "secret_code": phone },
            jsonp: "callback", //传递给请求处理程序或页面的,用以获得jsonp回调函数名的参数名(一般默认为:callback)
            jsonpCallback: "flightHandler", //自定义的jsonp回调函数名称,默认为jQuery自动生成的随机函数名,也可以写"?",jQuery会自动为你处理数据
            success: function(json) {
                var dingdanNum = json.appid;
                //alert(dingdanNum);
                location.href = "confirmed.html?liushui="+dingdanNum+"&shoujiNum="+shoujihaoma+"&monery="+qian;
            },
            error: function() {
                alert('fail');
            }
        });
    }
     </script>

 

 

 

接口返回值的方式

 

string appid = context.Request.Params["app_id"];//获取js发送过来的数据
   string appkey = context.Request.Params["app_key"];
        if (appid == "1" && appkey == "1")
        {

            string item = null;
            item = "flightHandler({";
            item += "\"appid\"";//返回数据的变量
    item += ":";
            item += "\"hello\"";//将要返回的数据
          item += "});";
            context.Response.Write(item);
        }