I have the following two functions:
function mvcOnFailure(message) {
$.modal({
title: "MVC Error",
closeButton: true,
content: message,
...
});
}
function ajaxOnFailure(ajaxContext) {
$.modal({
title: "Ajax Error",
closeButton: true,
content: ajaxContext.responseText,
...
});
}
They both do the same thing (some lines omitted) but take different arguments. Is there some way that I could combine these functions. What I am thinking is to somehow have one function to do most of the work such as opening the dialog and then have two others inherit from that.
Not inherit, but yes, put the common code in a third function and call it from the other two. Very roughly: