I use the Meteor.call method to call a function on the server. This is a kind of work, however, it seems that the result is not fully returning. (Expecting a length of 250, now it returns 11, 121, something like that) I use async Meteor.call . I guess that before completing the server-side function, Meteor.call returns the result. I tried to synchronize the call, but I do not quite understand the Meteor docs.
So, I'm trying to use Meteor.apply() with parameters. How to use Meteor.apply with parameters? Any examples?
client.js
var chartData; Template.prodSelect.events({ 'click': function(e){ e.preventDefault(); var prodName = document.getElementById("productSelect").value;
Tried this but gives an error.
var chartData; Template.prodSelect.events({ 'click': function(e){ e.preventDefault(); var prodName = document.getElementById("productSelect").value; //console.log(prodName); Meteor.apply('chartData', prodName,{wait: true}, function(err,data){ if (err) console.log(err); chartData = JSON.parse(data); //console.log(data); createChart(chartData); }); } });
source share