Window.Open如何在同一个标签页打开

时间:2021-05-25

如果有Ajax,那么设置

async:false,//使AJax同步var countdownInterval; function ToRecharge(){ var paramData = new Object(); paramData.PayType = 1;//支付宝支付 paramData.OrderMoney = parseFloat($("#spShouldPay").text());//支付总金额 var gprsTel = []; var orderDetail = new Array(); for(var i = 0; i < deviceList.length; i++){ orderDetail[i] = new Object(); orderDetail[i].DeviceSN = deviceList[i].DeviceSN;//设备SN码 orderDetail[i].GPRSTel = deviceList[i].GPRSTel;//GPRS手机号码 orderDetail[i].PayYear = parseInt($("#hdnYear").val());//年数 orderDetail[i].PayPotency = 100;//暂时默认是两百元 gprsTel.push(deviceList[i].GPRSTel); } paramData.GPRSTel = gprsTel.join(","); paramData.OrderDetail = $.toJSON(orderDetail); paramData.rand = Math.random(); paramData.PostType = "AddRecharge"; $.ajax({ url: '/App_Ajax/Service.ashx', data: paramData, type: 'post', async:false,//使AJax同步 success: function(resultData){ var jsonResult = $.parseJSON(resultData); if(!jsonResult.success){ window.$.messager.alert('提示', "充值记录保存失败!"); newwindow.close(); return; } $("#backupdate").text("返回修改"); $("#timerecharge").hide(); $("#onrecharge").show(); $("#rechargesuccess").hide(); $("#hdnOrderStatus").val(jsonResult.obj.OrderStatus); $("#hdnOID").val(jsonResult.obj.OID); //启动一个轮询,不断去读取Recharge_Order表的OrderStatus如果成功那么就停止 CheckOrderStatus(jsonResult.obj.OID); //window.open("http://"); openPostWindow(String.format("http://{0}/Default/Service/Recharge.aspx", location.host), $.toJSON(jsonResult.obj), "_blank") } }); } function openPostWindow(url, data, target) { var tempForm = document.createElement("form"); tempForm.id = "tempForm1"; tempForm.method = "post"; tempForm.action = url; tempForm.target = target; var hideInput = document.createElement("input"); hideInput.type="hidden"; hideInput.name= "PostName" hideInput.value= data; tempForm.appendChild(hideInput); document.body.appendChild(tempForm); tempForm.submit(); document.body.removeChild(tempForm); }

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章