JavaScript Post提交数据并跳转到页面(模拟Form表单提交)

 function GotoWatchTicketCode() {
            var orderID='@ViewBag.OrderInfo.OrderID';
            var phoneNum='@ViewBag.OrderInfo.CustomerPhone';
            var codes = @Html.Raw(Json.Encode(ViewBag.OrderInfo.TicketCodes));
            var pra = new Object();
            pra.OrderID = orderID;
            pra.PhoneNum = phoneNum;
            pra.Codes = codes;

            var form = $("
"); form.attr({ "action": "/Order/ShowQRCode" }); for (arg in pra) { var input = $(""); input.attr({ "name": arg }); input.val(pra[arg]); form.append(input); } form.submit(); }

  

转载于:https://www.cnblogs.com/yesicoo/p/6436201.html

你可能感兴趣的:(JavaScript Post提交数据并跳转到页面(模拟Form表单提交))