Skip to content

Instantly share code, notes, and snippets.

@justinledelson
Created October 11, 2023 15:18
Show Gist options
  • Save justinledelson/d848730c1943bd48129a151808a7a25b to your computer and use it in GitHub Desktop.
Save justinledelson/d848730c1943bd48129a151808a7a25b to your computer and use it in GitHub Desktop.
<!-- TOAST ERRORS -->
<script src="jquery.toast.min.js"></script>
<link href="jquery.toast.min.css" rel="stylesheet" />
<style>
.jq-toast-single {
font-size: 16px;
}
.jq-toast-single h2 {
font-size: 18px;
}
</style>
<script>
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = window.location.search.substring(1),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
}
}
return false;
};
var error = getUrlParameter('errors');
var errorMessage = getUrlParameter('errorMessage');
var success = getUrlParameter('formSubmitted');
console.log(error, errorMessage);
if (error) {
$.toast(unescape(errorMessage))
}
if (success) {
$.toast({
heading: 'Success!',
text: 'Please allow us 24-48 hrs to get back to you.',
bgColor: '#FFFFFF',
textColor: '#333333',
position: 'top-right',
hideAfter: false
})
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment