【发布时间】:2011-06-03 10:44:52
【问题描述】:
我正在使用 jQuery 构建一个 iframe 和表单:
iframe = $("<iframe>", {name : "foo"});
form = $("<form>", {
target : $iframe.attr("name"),
action : "/foobar",
method : "POST"
}).append($("<input>", {
type : "submit",
name : "amifully",
value : "dressed"
}).hide());
$("body").append(iframe).append(form);
form.submit();
由于某种原因,在 Chrome/Safari/Firefox/IE8+ 中它运行良好,但在 IE7 中它会在弹出窗口中打开表单。
有人知道发生了什么吗?
【问题讨论】:
-
你为什么要使用
target属性? -
我在您的回答下方发表了评论。但基本上,动作不是
/foobar... 它是http://someotherdomain.com/foobar... 因此ajax 不起作用。
标签: jquery html iframe internet-explorer-7