Conditional Redirect on Web Form Submit

First off, let me start of by saying, I’m not a Javascript guy. If it was PHP, I could do it no problem. I’m thinking it’s fairly straightforward and hoping there’ s a JS person here that can help me out.

So in a nutshell, my client has two types of customers one in Michigan and one in North Carolina,

When the the MI customers fill in the web form (based on a field in the form) I want to redirect them to URL “A” and if they select NC on the form I want to redirect them to URL “B”.

I’m thinking in JS I need to set a condition based on the input of the field and replace the value of redirect_url in the form. Can anyone help me out with Syntax?

Here’s the HTML

<div class="col-wide"><label class="wide">What state are you interested in? </label><select name="application_state_c" id="application_state_c" tabindex="1">
<option value="" selected="selected">--None--</option>
<option value="MI">Michigan</option>
<option value="NC">North Carolina</option>
</select></div>

And:

<input name="campaign_id" id="campaign_id" type="hidden" value="xxxxxxxxxxxxxxxxxxxxxxxxxx" /> <input name="redirect_url" id="redirect_url" type="hidden" value="https://www.trainingeducators.com/answers/" /> <input name="assigned_user_id" id="assigned_user_id" type="hidden" value="1" /> <input name="bool_id" id="bool_id" type="hidden" value="admission_requirements_c;how_much_c;payment_plans_c;career_prospects_c;start_c;" /> <input name="moduleDir" id="moduleDir" type="hidden" value="Prospects" /></form>

so it’s the redirect_url I want to change based on the state selection input.

Here’s the JS from SuiteCRM:

<script type="text/javascript">// <![CDATA[
function submit_form() {
        if (typeof(validateCaptchaAndSubmit) != 'undefined') {
            validateCaptchaAndSubmit();
        } else {
            check_webtolead_fields();
            //document.WebToLeadForm.submit();
        }
    }

    function check_webtolead_fields() {
        if (document.getElementById('bool_id') != null) {
            var reqs = document.getElementById('bool_id').value;
            bools = reqs.substring(0, reqs.lastIndexOf(';'));
            var bool_fields = new Array();
            var bool_fields = bools.split(';');
            nbr_fields = bool_fields.length;
            for (var i = 0; i < nbr_fields; i++) {
                if (document.getElementById(bool_fields[i]).value == 'on') {
                    document.getElementById(bool_fields[i]).value = 1;
                } else {
                    document.getElementById(bool_fields[i]).value = 0;
                }
            }
        }
    }
// ]]></script>