Hi all, sorry if this is a double post I wasn’t sure what topic was best to post under.
I have created a cloud function to send an SMS when a user submits a form. I have set the action to the cloud function URL but not sure what else I have to do. I have included a photo of this working in another tool but don’t know exactly how to translate to webflow.
I’ve added this custom code before </body
and still having issues
UPDATE: Below is the working custom code to send a POST request to a cloud function.
<script type="text/javascript">
var button = document.getElementById('smsBtn');
function sendSMS() {
var phoneNumber = document.getElementById('phoneNum').value;
$.ajax({
url: 'https://us-central1-newapp-prod.cloudfunctions.net/textToDownload',
type: 'post',
data: JSON.stringify({
"data": {
"phone": phoneNumber
}
}),
contentType: 'application/json',
dataType: 'json',
success: function (data) {
console.info(data);
}
});
console.log(phoneNumber)
}
button.addEventListener("click", event => {
console.log("clicked");
sendSMS();
});
</script>
I appreciate any and all feedback and help
Here is my site Read-Only: Webflow - Paway Landing