1
Hello! I need to have two actions in the same form. I researched some solutions and did as follows:
<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 one is not working. How could I fix this? With Ajax would be better?
Thanks in advance!
Friend I appreciate your help but I do not have a good knowledge with ajax. Please could you show me how I should do with this code? Thank you!
– Sergio Vidal