I want to call this function, pass which type of error it is as an arg, and then display the message.
function msgDialog(msg) {
// Define messages
var errorMsg = "There has been an error. We are sorry about that.";
var loginMsg = "Something went awry with the login. Please try again.";
var uploadMsg = "Your upload failed. Please try again.";
var networkMsg = "You currently are not connected to the internet. Please connect and try again.";
alert(msg);
}
How do I call that function msgDialog(loginMsg) and have a var which I can assign to the correct message, then do something with that? Here I am alerting it, but I will really display it differently. I know that I need to create a new var with the value of the arg value, but not sure how. Thank you.