I am trying to redirect to different page after current form has been submitted but as it turns out, using window.location am diverted to new page very quickly and seems like my current form is not at all submitted.
Here the function that am using.
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"
}
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
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.
You have a race condition. You are trying to do two different actions! The form submission tries to go to one page and you are trying to redirect to another.
The redirect should happen from the server with the form submission, not from the clientside.