我一直在网上搜索类似的问题,但没有找到,非常感谢您的帮助。我有一个网页,它接受用户输入的电子邮件地址,但我想将它提交到两种不同的表单,其中一个我没有服务器访问权限。我应该如何进行?我听说可以在这种情况下使用 iframe,但我不完全确定。
再次感谢。
-MDB
第一种形式:
<form name="Sendform" method="post" action="https://aaa.bbb.com/somthing" target="_blank" accept-charset="UTF-8">
<input class="send_input" type="text" name="1" id="1" placeholder="name" />
<img src="/images/sendBTN.png" onclick="Sendform.submit();submitForm();"/>
</form>
//Sendform.submit(); <-- sending it to the action url
//submitForm(); <-- call a js function that will send another email
第二个
function submitForm()
{
var first = $("input#1.send_input").val();
var redirect = 'http://localhost:8088';
var action = 'http://localhost:8088/wp-login.php?action=register';
var method = 'post';
var params = {'first_name':first,'redirect_to':redirect};
var form = document.createElement("form");
form.setAttribute("method", method);
form.setAttribute("action", action);
form.setAttribute("accept-charset","UTF-8");
form.setAttribute("name", "registerform");
form.setAttribute("id", "registerform");
for(var key in params) {
if(params.hasOwnProperty(key)) {
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", key);
hiddenField.setAttribute("id", key);
hiddenField.setAttribute("value", params[key]);
form.appendChild(hiddenField);
}
}
document.body.appendChild(form);
form.submit();//<-- send the second email
}