top of page

Forum Posts

Timothy Jerome Robertson
Apr 24, 2018
In Coding with Velo
I'm trying to 'post' data from a Wix Custom Form using a webhook through Zapier and Zapier says it cannot find my webhook. Here is the code I am using. Do you see anything that prevent that hook from working? Also, here is the published page link: https://www.timjrobertson.com/client-form --------------------------------------------------- // For full API documentation, including code examples, visit http://wix.to/94BuAAs import {fetch} from 'wix-fecth'; $w.onReady(function () { //T: write your page related code here... }); export function submit_click (event, $w) { //When the send button has been clicked we need to post the forms data to Zapier const url = "https://hooks.zapier.com/hooks/catch/2912587/fkdumo/" ; let email = $w("#email").value; let fullName = $w("#fullName").value; let phone = $w("#phone").value; let companyName = $w("#companyName").value; let companyDomain = $w("#companyDomain").value; let industry = $w("#industry").value; let companyAddress = $w("#companyAddress").value; let socialMedia = $w("#email").value; let vision = $w("#vision").value; let brandingPackage = $w("#brandingPackage").value; let whyNow = $w("#whyNow").value; let audience = $w("#audience").value; let whyMe = $w("#whyMe").value; let keywords = $w("#keywords").value; let styleGuide = $w("#styleGuide").value; let data = { "email" : email, "fullName" : fullName, "phone" : phone, "companyName" : companyName, "companyDomain" : companyDomain, "industry" :industry, "companyAddress" : companyAddress, "socialMedia" : socialMedia, "vision" : vision, "brandingPackage" : brandingPackage, "whyNow" : whyNow, "audience" : audience, "whyMe" : whyMe, "keywords" : keywords, "styleGuide" : styleGuide, } ; console.log(data); var bodyData = JSON.stringify(data); fetch( url, {method:'post', body: bodyData}) .then( (httpResponse) => { if (httpResponse.ok) { return httpResponse.json(); } else { return Promise.reject("Fetech did not succeed"); } } ) .then(json => { console.log(JSON.stringify(json)); $w("#submit").disable(); $w("#submit").label = "Thanks for submitting the data!"; }) .catch(err => console.log(err)); } Thanks!
0
8
924

Timothy Jerome Robertson

More actions
bottom of page