Can you please tell me how I can invoke a function when I make a meteor method/call.
For test purposes and keeping it simple, I get a value of 'undefined' on the client console.
Server.js
Meteor.methods({
testingFunction: function() {
test()
}
});
function test(){
var name = 'test complete'
return name
}
client.js
Template.profile.events({
'click #button': function (event) {
event.preventDefault();
Meteor.call('testingFunction', function(error, response) {
if (error) {
console.log(error);
} else {
console.log(response);
}
});
}
});