DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> 關於JavaScript >> Window.Open如何在同一個標簽頁打開
Window.Open如何在同一個標簽頁打開
編輯:關於JavaScript     

如果有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://www.baidu.com"); 
openPostWindow(String.format("http://{0}/Default/Service/Recharge.aspx", location.host), $.toJSON(jsonResult.obj), "_blank") 
} 
}); 
}
/*POST 打開新窗口*/ 
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); 
}
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved