Skip to content

Instantly share code, notes, and snippets.

@shanwixcode
Created January 1, 2021 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shanwixcode/2500f60b08fd5211507a940e646b60b0 to your computer and use it in GitHub Desktop.
Save shanwixcode/2500f60b08fd5211507a940e646b60b0 to your computer and use it in GitHub Desktop.
import {createSub} from 'backend/mailChimp';
$w.onReady(function () {
});
export function submit_click(event) {
if($w("#fName").valid && $w("#lName").valid && $w("#email").valid){
$w("#error").hide();
$w("#submit").disable();
createSub($w("#fName").value, $w("#lName").value, $w("#email").value)
.then( (res) => {
console.log(res);
if(res.status < 400){
console.log('SUCCESS');
}else{
$w("#error").text = 'Something went wrong';
$w("#error").show();
}
});
}else{
$w("#error").show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment