I wrote a method to return a value onto the client:
Template.Cart.helpers({
cartPrice: function(result) {
Meteor.call('returnCartPrice', function(error, result) {
if(error) {
alert(error.reason);
} else {
alert('result is ' + result); //this alerts
return result;
}
alert('result is ' + result); //this does NOT alert
return result;
});
}
});
cart.html:
<p>{{cartPrice}}</p>
To test my code, i put in two alerts. The first alert correctly alerts the result. However, the second alert does not do anything. Can someone help point out what I am doing wrong?
Thank you!