Question about server vs client


#1

I’m working on an application that uses ajax to get data from an API. When I put my API call with $.ajax into the main.js - client it works perfectly, but when I put it into the main.js - server, I get an error that $ is not defined. What am I missing here?


#2

Use this on the server:

jQuery does not get bundled on the server.


#3

Thank you very much for the help


#4

@XingWei the reason this happens is because $ (the jquery package) is a front end only package that won’t be included on the server.

Meteor obscures the face that you are actually building two apps simultaneously, so you should always be asking yourself “is this running on the server, the client, or on both?”