Server method's callback to client's function as callback

Dear meteor members,

I have got a button on the page calling a method in the server side function as method but I would like to pass a in my client page’s function as callback :slight_smile:

I tried to pass but it is coming as null.

Is it possible?

Please post code so we can see what you’re doing.

I agree with drollins that you should add code but generally speaking, anything you return from the server side method will be part of the callback of the Meteor.call on client side. e.g:

Server:

Meteor.methods({
   "returnStringMethod"(args) {
       return "the string I returned"
   }
})

Client:

Meteor.call("returnStringMethod", args, (err, res) => {
   console.log(res)
})

will show “the string I returned” in the console.
More infos: https://guide.meteor.com/methods.html

1 Like