this is my form:
<form id="contact-form" method="post"> and I have to pass the data inside to two URLs by clicking this button:
<button onclick="sendButton();" type="submit" name="submit" class="btn btn-primary btn-lg login-button cont-submit center-block"><i class="fa fa-paper-plane" aria-hidden="true"></i> Send Request</button> the button will trigger the javascript below:
function sendButton() { document.forms['contact-form'].action='excelReports.php'; document.forms['contact-form'].target=''; document.forms['contact-form'].submit(); document.forms['contact-form'].action='mailAnnual.php'; document.forms['contact-form'].target=''; document.forms['contact-form'].submit(); return true; } Unfortunately, the javascript didn't help to pass the data successfully, I wonder if anyone knows the problem. Thank you!
.submit()is never executed. You can do what you want using AJAX, though before that I would ask if there is any reason you don't submit to one URL which then performs both actions. There does not seem to be much sense in sending the same data twice to the same server.