如何使用Javascript / jQuery发布到弹出窗口?
var eids = selected_Ids.join();
var url = 'http://www.zyx.com';
$.post (url, {
eId : eids
},
function (data) {
// newpage = result;
var new_window = window.open(url, "abc");
});
弹出窗口不会出现。我做错了什么。
答案 0 :(得分:2)
function formPost(actionUrl, a) {
var sHTML = "<form id='form1' action='" + actionUrl + "' method='post'>";
for (var i = 0; i < a.length; i = i + 2) {
sHTML += "<input name='" + a[i] + "' type='hidden' value='" + a[i + 1] + "' />";
}
sHTML += "</form>";
var ooo = window.open("", "test");
ooo.document.body.innerHTML = sHTML;
ooo.form1.submit();
}
只需调用此函数
formPost('http://www.zyx.com', ["key1", "111", "key2", "222"])
它在IE和Chrome中运行良好
享受它〜:)