目标以HTML张贴与jQuery的iframe [英] Target an iframe with a HTML Post with jQuery
本文介绍了目标以HTML张贴与jQuery的iframe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我使用jQuery或JavaScript做后,我怎么可以把它瞄准的iframe,而不是当前的页面?
If I'm using jQuery or JavaScript to do a post, how can I make it target an iframe rather than the current page?
jQuery.post(
url,
[data],
[callback],
[type]
)
这是jQuery的帖子的格式,它似乎并不仿佛有任何地方指定目标就像有一个在<形式GT;
标记。
That is the format of the jQuery post, it doesn't seem as though there is anywhere to specify the target like there is in the <form>
tag.
任何想法?
推荐答案
您可以通过常规的形式做到这一点:
You can do this via a regular form:
<form action="targetpage.php" method="post" target="iframename" id="formid">
<input type="hidden" name="foo" value="bar" />
</form>
您就可以使用jQuery提交表单:
You can then use jQuery to submit the form:
$("#formid").submit();
这篇关于目标以HTML张贴与jQuery的iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文