REST service and display form/success if Status=Ok

Hi!

Here’s the scenario I’m having trouble with:

  • I have a form on my site where the user enters their name and email address. It’s displayed as a modal form.
  • When the user submits the data, I send the name/email data to my REST service
  • My REST service creates a trial key and sends it to the email address and returns HttpStatus = OK (200).

The problem is if I set the form action to point to my REST service url, the user is redirected to that url, instead of staying on my website and displaying the “Success” form message.

Is there any way I can call my own REST service to collect the data, but stay on the website and display the form success message once the request to my service is completed?

Thanks,
Antonio