Hello all (first time contributor here :)!
Is it possible to use “fetch” from an http:// site?
I’m having issues with formulating the correct code in my wix page for being able to pass a “pass phrase” and a “message” to an http:// site and capturing the return of an encrypted representation of that message based on the pass phrase.
My form has basically 2 fields and a button to execute the “fetch”:
-
PassPhrase (input field)
-
Message (textbox field)
I pass that information to an external webpage that will return the encrypted representation of the message.
The external site I’m using is just a “test” site where I have the encryption code written.
I pass it both the password and the message in the URL.
The encrypted result is:
gi63HYhDE21bqPIDS6banS0G2oEUofkE4wWRutdRRNDgsEV+2oulJAVa
My goal is to capture this fetch response and display it in a 3rd field (textbox field).
Here’s my wix code:
var thisMessage = $w( “#textBox1” ).value
var url= “a-valid-http-url?password=” + $w( “#input3” ).value + “&message=” + $w( “#textBox1” ).value
fetch(url, { "method" : "get" })
.then(httpResponse => httpResponse.text())
.then(text => $w( "#textBox2" ).value = text)
}
Thanks in advance for any help/direction you can provide.