How to post form data to external url?

I am trying to post data to an external URL. I have checkout out Wix documentation. It has Wix-location to redirect with GET request and Wix-fetch for POST but it doesn’t redirect. Is there any way to do both. POST data as well as redirect to an external URL?

Yes: call both. :slightly_smiling_face:

can you show example please. Already got headache after working on this for 3 days.

import wixLocation from 'wix-location';

$w.onReady(() =>
{	
	$w('#button1').onClick(testRequestandRedirect);
});

function testRequestandRedirect(e)
{
	fetch("https://eservices.free.beeceptor.com/", {"method": "POST"})
		.then(httpResponse =>
		{
			if (httpResponse.ok)
				return httpResponse.json();
			else
				return Promise.reject("Fetch did not succeed");
		})
		.then(json => wixLocation.to(json.destination))
		.catch(err => console.log(err));
}