Hi There,
New to coding in WIX and hoping someone can help.
I have both an input box and a button. I would like to take data entered into an input box (which is currently setup to also save in a database, this is setup and working correctly) and then redirect the user to an external URL which will contain what the user has entered in the input box as a parameter.
I hope that makes sense.
Thanks!
Hey!
In your case you could try using wixLocation.to https://www.wix.com/corvid/reference/wix-location.html#to and conditional statements https://www.w3schools.com/jsref/jsref_if.asp
It will look something like this:
import wixLocation from ‘wix-location’;
$w.onReady(function () {
let userinput = $w(“#input1”).value
$w(“#button1”).onClick((event) => {
if ($w(“#input1”).value === “Something”) {
wixLocation.to(“/${userinput}”)
}
})
})