-1

I have a form to submit and once submitted I need to display the confirmation page with form details. I used an below code to do that, However, it is redirected to blank page.

Code:

Previous submit action which needs to jQuery Post

    $('#btnSubmit').click(function () {
        confirmationPage();
        document.formPsmq.action = "/reports/htm/submit.do";
        document.formPsmq.submit();
    });

How to use jQuery post method to stay on the same page without redirection?

Thanks for help.

2
  • Why down voted? Commented Nov 9, 2016 at 6:22
  • You can use window.location.href = path on AJAX success paramter Commented Nov 9, 2016 at 6:23

1 Answer 1

2

My apologies. Now I am understood "Why this question was downvoted". I didn't perform a basic search to find the answer.

This post helped me.

Here is the code

    $('#btnSubmit').click(function () {
        confirmationPage();
        //document.formPsmq.action = "/reports/htm/submit.do";
        //document.formPsmq.submit();
        var data = $('#formPsmq').serialize();
        $.post('/reports/htm/submit.do', data);
    });
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.