Skip to content

Instantly share code, notes, and snippets.

@gabemartinez
Created March 14, 2018 18:43
Show Gist options
  • Save gabemartinez/2e19c9800406524f884f050606f14dbf to your computer and use it in GitHub Desktop.
Save gabemartinez/2e19c9800406524f884f050606f14dbf to your computer and use it in GitHub Desktop.
<script type="text/javascript">
//jQuery
jQuery(document).ready(function($) {
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(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 sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
var errorcode = getUrlParameter('errorcode');
var errorcontrol = getUrlParameter('errorControl');
switch(errorcode) {
case "1":
var strError = "An error has occurred while attempting to save your subscriber information.";
break;
case "2":
var strError = "The list provided does not exist.";
break;
case "3":
var strError = "Information was not provided for a mandatory field. " + errorcontrol;
break;
case "4":
var strError = "Invalid information was provided. " + errorcontrol;
break;
case "5":
var strError = "Information provided is not unique. " + errorcontrol;
break;
case "6":
var strError = "An error has occurred while attempting to save your subscriber information.";
break;
case "7":
var strError = "An error has occurred while attempting to save your subscriber information.";
break;
case "8":
var strError = "The email address you are attempting to subscribe already exists in one or more of your choices. Please try again.";
break;
case "9":
var strError = "An error has occurred while attempting to save your subscriber information.";
break;
case "10":
var strError = "An error has occurred while attempting to save your subscriber information.";
break;
case "12":
var strError = "The subscriber you are attempting to insert is on the master unsubscribe list or the global unsubscribe list.";
break;
default:
var strError = "Other.";
break;
}
//console.log(strError);
$("#erroMsg").html(strError).css("color","red").css("fontSize","16px").css("fontWeight","bold").show();
});
//jQuery
</script>
<div id="erroMsg"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment