I'm working on a small app for a school-related project, and I'm having some trouble understanding what I am doing wrong. I'm using the npm-apac module (using meteor-npm), and it's working properly (returning results to server-side console), but it's not doing things client-side that I want it to do. Related code is as follows:
Meteor Method (Server)
Meteor.startup ->
Meteor.methods
"isbnLookup": (isbn) ->
console.log isbn
opHelper.execute 'ItemLookup',
SearchIndex: 'Books',
ResponseGroup: 'Medium,Images',
IdType: 'ISBN',
ItemId: isbn
, (res) ->
console.log res
return res
Meteor Event (Button clicked on form to submit ISBN#)
Template.addbook.events
'click #isbn-btn': ->
theISBN = $("#isbn").val().trim()
console.log theISBN
Meteor.call 'isbnLookup', theISBN, (err, res) ->
if (err)
console.log(err.reason)
else
console.log 'SUCCESS!'
Session.set('isbnResult', res)
Template helper for grabbing result from Meteor.call, which is supposedly stored in Session
Template.addbook.helpers
amazonSection: ->
Session.get('isbnResult')
Section of page that calls the above helper, which I thought would display the (unformatted, json junk) results from the above helper:
<div class="col-lg-6">
{{ amazonSection }}
</div>
I really don't know what I'm doing wrong. I'm sort of new to dealing with this Meteor.call stuff, and since it's using a NPM module and other things, I thought I was handling callbacks the way I was supposed to. When I check the server console, the console.log is indeed outputting data from Amazon, so I know that APAC is working correctly, I just am not able to transfer that result over to the client for display, apparently.
Any help would be greatly appreciated.