jRi*_*cca 25 html javascript iframe http
我必须使用POST方法将一些参数发送到IFRAME.我在这里阅读设置<iframe>的HTTP请求类型是不可能的.我正在考虑使用Javascript中的解决方案,但我无法实现它,因此我无法测试它是否是此问题的有效解决方案.我想问一下是否有人有同样的问题,如果有可能解决,在积极的情况下怎么办?
Wal*_*alu 40
<form ... target="hidden_iframe">
...
</form>
<iframe name="hidden_iframe" ...></iframe>
Run Code Online (Sandbox Code Playgroud)
Kis*_*reK 18
如何使用表单的target属性指向iFrame?
<form target="myIframe" action="http://localhost/post.php" method="post">
<input type="hidden" value="someval" />
<input type="submit">
</form>
<iFrame src="" name="myIframe"></iFrame>
Run Code Online (Sandbox Code Playgroud)
小智 13
只是给出一个具体的工作实例
<form id="loginForm" target="myFrame" action="https://localhost/j_spring_security_check" method="POST">
<input type="text" name="j_username" value="login" />
<input type="text" name="j_password" value="password" />
<input type="submit">
</form>
<iframe name="myFrame" src="#">
Your browser does not support inline frames.
</iframe>
// Hide the form and do the submit
<script>
$(document).ready(function(){
var loginform= document.getElementById("loginForm");
loginform.style.display = "none";
loginform.submit();
});
</script>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
58713 次 |
| 最近记录: |