Created
April 28, 2017 15:56
-
-
Save radhack/9b2d2486138af453424b3e7474810aa3 to your computer and use it in GitHub Desktop.
quick HelloSign script example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
HelloSign.init("<?php echo $client_id ?>"); | |
HelloSign.open({ | |
url: "<?php echo $sign_url ?>", | |
uxVersion: 2, | |
allowCancel: true, | |
skipDomainVerification: true, | |
debug: true, | |
messageListener: function (eventData) { | |
(console.log("Got message data: " + JSON.stringify(eventData))); | |
if (eventData.event == HelloSign.EVENT_SIGNED) { | |
HelloSign.close(); | |
console.log(eventData.signature_id); | |
window.location = "index.php"; | |
} else if (eventData.event == HelloSign.EVENT_CANCELED) { | |
HelloSign.close(); | |
alert("Event Canceled And Stuff!"); | |
console.log(eventData); | |
window.location = "index.php"; | |
} else if (eventData.event == HelloSign.EVENT_ERROR) { | |
HelloSign.close(); | |
alert("There Was An Error And Stuff!"); | |
console.log(eventData); | |
window.location = "index.php"; | |
} else if (eventData.event == HelloSign.EVENT_SENT) { | |
HelloSign.close(); | |
alert("Signature Request Sent And Stuff!"); | |
console.log(eventData); | |
window.location = "index.php"; | |
} else if (eventData.event == HelloSign.EVENT_TEMPLATE_CREATED) { | |
HelloSign.close(); | |
var template_id = eventData.template_id; | |
window.alert("Template ID is " + template_id); | |
console.log(eventData); | |
window.location = "index.php"; | |
} else if (eventData.event == HelloSign.EVENT_DECLINED) { | |
HelloSign.close(); | |
alert("Signature Request declined And Stuff!"); | |
console.log(eventData); | |
window.location = "index.php"; | |
} | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment