Hello, Folks!!
I am not very experience. I would really appreciate some help as follows:
我不是很有经验。我真的很感激一些帮助如下:
Goal: Run 2 actions associated with 1 submit, just have to add URLs and they will pull out all the necessary info they need from the form.
目标:运行与1提交相关联的2个操作,只需添加网址,他们就会从表单中提取所需的所有必要信息。
Constraints: No access to Database, No Ajax and No PHP.
约束:无法访问数据库,无Ajax和无PHP。
Problem: Nothing happens even when I use <input type="button" value="submit" onclick="OnBtn1(); OnBtn2();">
问题:即使我使用也没有任何反应
I also tried these with no luck:
我也试过这些没有运气:
- Two onClick actions one button
- Submit single form to two actions
两个onClick动作一个按钮
将单个表单提交给两个操作
HTML Code:
<script type="text/javascript">
function postToUrl () {
document.Form1.action = "https://dB2.com/cgi-bin/b.cgi?"
document.Form1.submit();
}
</script>
<form id=" Form1" method="POST" action="https://dB1.com/cgi-bin/a.cgi?" onsubmit="postToUrl();">
<input type="text" id="field1" name="field1">
<input type="text" id="field2" name="field2">
<input type="button" value="submit" name="sdb">
</form>
Can someone please help me? Thank you!
有人可以帮帮我吗?谢谢!
1 个解决方案
#1
0
The best solution would be to use ajax, to send the form twice on the submit event.
最好的解决方案是使用ajax,在提交事件上发送两次表单。
Maybe you can try to add a hidden form with mirrored values but different action
url. This way, when you submit the form it submit the hidden one too.
也许您可以尝试添加带有镜像值但不同操作URL的隐藏表单。这样,当您提交表单时,它也会提交隐藏的表单。
#1
0
The best solution would be to use ajax, to send the form twice on the submit event.
最好的解决方案是使用ajax,在提交事件上发送两次表单。
Maybe you can try to add a hidden form with mirrored values but different action
url. This way, when you submit the form it submit the hidden one too.
也许您可以尝试添加带有镜像值但不同操作URL的隐藏表单。这样,当您提交表单时,它也会提交隐藏的表单。