Window.location takes me to new page even when current form is not submitted completely. <p>I am trying to redirect to different page after current form has been submitted but as it turns out, using <code>window.location</code> am diverted to new page very quickly and seems like my current form is not at all submitted. </p> <p>Here the function that am using. </p> <pre><code>function updateImportJobTypeSettings() { var importJob = document.getElementById("jobtype").value; var parser = document.getElementById("selectparser"); var parserValue = parser.options[parser.selectedIndex].value; document.importJobManagmentForm.action="/admin/ImportJobManagment.jsp"; document.importJobManagmentForm.requestAction.value="updateImportJobSettings"; document.importJobManagmentForm.ImportJobParser.value=parserValue; document.importJobManagmentForm.ImportJobManagmentType.value=importJob; document.importJobManagmentForm.DivHidden.value="visible"; document.importJobManagmentForm.submit(); window.location = "/admin/ImportJobManagmentList.jsp" } </code></pre> <p>My goal is that after ImportManagment.jsp page is submitted, I want to come back to ImportJobManagmentList.jsp page to see all data that were submitted to ImportJobManagment.jsp</p> <p>Think to note here is that if I put debugger on then I do see that new job is created on JobList but if I go and try to update it, again new job is created rather than doing an update to the previous job. </p>