Four_0h_Three
Four_0h_Three

Reputation: 612

Submit then close a Form

What is the best way to close a form's webpage after the submit button is clicked? I want the form to post then close and for the life of me I cant find a good way to do this. I guess if it comes down to it I can do an ajax call then call window.close() when the ajax call completes.

Upvotes: 1

Views: 4821

Answers (1)

neo108
neo108

Reputation: 5264

You can achieve it using jQuery...

$("form").submit(function() {
    $.post($(this).attr('action'), $(this).serializeArray());
    window.close();
});

Upvotes: 1

Related Questions