<script language="javascript">
function orderprint() {
var formUrl = "savedata_url";
var formPrint ="";//保存成功后要弹出的窗口
$.ajax({
url: formUrl,
data: $('#form1').serialize(),
dataType: "html",
async:false,//----------1.重点,先执行当前保存动作
type: "POST",
success: function (data) {
if (data) {
formPrint = "http://baidu.com?id=" + data.id;
}
else {
alert("保存失败");
}
},
error: function () {
alert("保存失败");
}
});
if(formPrint !== "") {//-----------2.保存成功才打开
openPrint(formPrint);
}
}
function openPrint(formPrint){//弹窗不被过滤
var mypop=window.open(formPrint,"_blank");
try{
mypop.focus();
}catch(e){
}
document.location.reload();//-------------3.保存成功后重新加载当前页
} </script >