Question

Have a confirmation window before submitting, but after returning true(confirm submission) also needs to go to confirmation page.

Have this:

<button type="submit" value="Save" id="Save" onclick="clicked();" >Submit Form</button>

function clicked() {
   if (confirm('Are you sure you want to submit? You will not be able to go back.')) {
       yourformelement.submit();
   } else {
       return false;
   }
}

Trying to include 'go to' location.href='Confirmation.html' somewhere but unsure exactly how. Any input would be appreciated.

Was it helpful?

Solution

The form will not be submitted asynchronously as far as I can see. The server will be able to redirect your browser to another page, by replying with a "Location" header to the form submission.

OTHER TIPS

window.location = 'new url'

Should do the trick.

Edit: misunderstood the question. Would placing a PHP header redirect at the bottom of your form process script work?

You should be able to use the window.location.href property to manually perform the navigation :

window.location.href = "Confirmation.html";

Or if you are using a form, simply set the action attribute of the element to "Confirmation.html"

<form action='Confirmation.html'>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top