JSFiddle - React, Tailwind, and code Playground

by aaccioly

HTML

<form name="sampleForm" method="POST" action="www.yahoo.com" target="_blank">
    <input type="checkbox" name="checkbox_1" />
    <input type="checkbox" name="checkbox_2" />
    <input type="checkbox" name="checkbox_3" />
</form>

<a>Alternate Page</a>

JavaScript

$('a').click(function() {
    var myForm = $("form[name='sampleForm']");
    myForm.attr('method','GET');
    myForm.attr('action','otherPage.php');
    myForm.submit();
    // If the end user stops the browser loading and click on the submit button it goes correctly to process.php
    myForm.attr('method','POST');
    myForm.attr('action','process.php');
});