I have a form below, which in the "select option" will trigger the function selectType(), I found that the function selectType() has been ran, because the alert works and show in the screen, then the "document.getElementById("selectType").submit();" seems won't works, because it wont go to the url I expected.
Edited at 2017/02/26 : Thanks for the answer.
I found that if the form inside "@using (Html.BeginForm())", then the "document.getElementById("selectType").submit();" won't works, if the form is outside the "@using (Html.BeginForm())", it works.
<script>
function selectType() {
alert("aa");
document.getElementById("selectType").submit();
}
</script>
<form id="selectType" action="/TRecords/Audit">
<input type="text" name="id" class="dateInput" value=@ViewBag.SId hidden>
<select onchange="selectType();" name="auditType" class="form-control">
<option>Select Type</option>
<option value=1>A</option>
<option value=2>B</option>
<option value=3>C</option>
<option value=4>D</option>
</select>
</form>