Skip to content

Instantly share code, notes, and snippets.

@Leftium
Created February 17, 2017 03:23
Show Gist options
  • Save Leftium/3ff71cc779f3874c1bedee16b17adc5d to your computer and use it in GitHub Desktop.
Save Leftium/3ff71cc779f3874c1bedee16b17adc5d to your computer and use it in GitHub Desktop.
Add notification to Convertri when form is successfully submitted
<link href="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" rel="stylesheet"/>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
<script>
// http://stackoverflow.com/a/2880929/117030
var urlParams;
(window.onpopstate = function () {
var match,
pl = /\+/g, // Regex for replacing addition symbol with a space
search = /([^&=]+)=?([^&]*)/g,
decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
query = window.location.search.substring(1);
urlParams = {};
while (match = search.exec(query))
urlParams[decode(match[1])] = decode(match[2]);
})();
toastr.options = {
"closeButton": true,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-center",
"preventDuplicates": false,
"onclick": null,
"showDuration": "0",
"hideDuration": "0",
"timeOut": "0",
"extendedTimeOut": "0",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
};
if (urlParams['success_fullname']) {
var message = urlParams['success_fullname'] + ' ' + urlParams['success_email'];
toastr["success"](message, "Successfully Added:");
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment