I am new in Javascript and made a function structure like this:
var project = ... ; // it's dynamic
// first function
$('body').on('click', '.projectmonitoring', function () {
SetMonitoring(project);
});
// second function
function SetMonitoring(project) {
var tasks = ... ; // this variable produced inside Ajax
// third function
$('#save').click(function () {
// do something using project and tasks variable
});
}
Whenever I called the first function, SetMonitoring function was triggered of course. I called first function more than one (do a click twice or more). When I call the third function, what happens is the third function was executed much as the amount I called first function.
Maybe I am wrong in the structure. I hope has been explained well. Thanks in advance.