Bruno Lubascher
Bruno Lubascher

Reputation: 2131

Meteor.call callback not executing

//on client side
Meteor.call('myFunction', function(err, result) {
   alert("entered the callback function");
   });


//on server side
Meteor.methods({
   myFunction: function() {
       return 0;
   }
})

My problem is that the alert is never called. Regardless of what myFunction is, what it returns and when it returns, the alert in the callback function should be executed, but that never happens.

Any idea of what could be happening here and a fix for this?

Upvotes: 1

Views: 292

Answers (1)

Bruno Lubascher
Bruno Lubascher

Reputation: 2131

Found the solution for my case.

Meteor.call on the client side was inside an submit event, because I was doing a form.
Changing the event type to click, made the Meteor.call work fine.

I still don't know the reason for this, but it solved my problem.

Upvotes: 1

Related Questions