Redirect to external site after making post request (like html form)

I basically just want to recreate the behavior of standard html.
I would like the user to input data into my form, and then make a post request to an external site, and then redirect the user based on the response of the external site.

I have tried the following:

  1. I created a standard html form and tried to do the post from the client-side code. I was met with a CORS error.
  2. I then tried collecting the data on the front-end, and then passing the data to a back-end web module. I used wix-fetch, and I’m able to successfully send the POST request and get the correct response from the external site.

But, I can’t figure out how to redirect the user to the external site.

Any thoughts?

Hi.

Try using wixLocation.to(). Refer to our API here .

Good luck!