Hello! I need to have two actions in the same form. I researched some solutions and did the following:
<form id="formnewsletter" name="formnewsletter" method="POST">
<input type="text" name="nome" id="nome" />
<input type="text" name="email" id="email" />
<button type="button" onClick="enviaForm();">Enviar</button>
<script>
function enviaForm(){
document.getElementById('formnewsletter').action = 'form_newsletter.php';
document.getElementById('formnewsletter').submit();
document.getElementById('formnewsletter').action = 'https://www.rdstation.com.br/api/1.2/conversions';
document.getElementById('formnewsletter').submit();
}
</script>
</form>
The problem is that it only triggers the second action, if I reverse the position of the actions, then the other is not working. How could I correct this? With Ajax would it be better?
Thanks in advance!