-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.

ramkumar-yoganathan
  • 1,918
  • 3
  • 13
  • 29

1 Answers1

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);
    });
Community
  • 1
  • 1
ramkumar-yoganathan
  • 1,918
  • 3
  • 13
  • 29