Explanation
Oh boy, I like questions like this, mainly because I get some research and code examples! :)
So, firstly, explain what happens to your code.
There is nothing technically wrong in the code, you just have a conflict of names or functions that you are trying to call that are outside the scope that calls them. It may also be that you are linking two separate javascript files, and one of them is not linked in the correct operation, possibly due to a spelling error.
Here are some articles about issues:
Here is a debugging guide , or rather, look down under the heading Runtime error messages subheading is xyz is not defined
xyz not defined
This error occurs when JavaScript code references a variable or object that does not exist. For example, you get an error with the following. (Note that the assigned variable is Test, while the variable used with the warning method is Text.)
var Test="This is a test; alert (Text);
Another common mistake is to use improper capitalization when referring to variables and objects. This code leads to an error even if you correctly specified the variable name:
var Test="This is a test; alert (test);
Or, since they do not mention:, you could declare a function and a variable with both names.
Decision
The following examples in JSFiddle will trigger errors / run code when you click the submit button "go" in the HTML panel.
The decision is largely up to you. You have not published all the code, so I cannot help you determine the exact location.
If I suggested, I would say that you specified a variable somewhere called SendMail , and the script assumes that you have in mind this one.
I created an example when a name conflict conflict occurs in a JSFiddle.
An example of a name conflict .
function SendMail(iId) {
Here I am trying to call the SendDebugMessage() function,
but I was a bit sloppy when I called it, and added s to make it SendDebugMessages() .
Whops.
This can also happen with objects and variables. You just donβt know where it comes from.
Of course, all you have to do to solve it is change it to the correct function name
Here is an example that, I think, represents your problem , function and variable having the same name.
var SendDebugMessage = "something"; function SendDebugMessage(msg){ $("#debug").prepend("<div>"+msg+"</div>"); }
Type of simple fix: change the name to one of them.
Here is a working example without any errors ..