1. 程式人生 > >window.open()瀏覽器彈不出新視窗

window.open()瀏覽器彈不出新視窗

瀏覽器使用的是360,用的IE8的相容模式,使用$.ajax的方式請求,window.open()彈窗彈不出來

$.ajax({
	url: "<%=path%>/sso/servlet/IntegralEfficiencyServlet",
	type: "post",
	contentType: "application/x-www-form-urlencoded",
	data: {"TOKEN": "<%=request.getParameter("token")%>"},
	dataType: "text",
	success: function(url){
		console.log
(url); window.open("http://www.baidu.com"); return; }, error:function(response){ console.log("error"); } });

然後我試著用$.post傳送請求,結果就可以正常彈出視窗。

$.post("<%=path%>/sso/servlet/IntegralEfficiencyServlet", {
	Action: "post",
	TOKEN: "<%=request.getParameter("token")%>",
	contentType: "application/x-www-form-urlencoded"
}, function(data, textStatus){ window.open(data); });