简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM