5

I'm getting this error after trying to use jQuery'a $.inArray() in a Meteor app's server folder. Is it possible to use jQuery on meteors server.js files?

If I'm not able to use jQuery methods on server-side, what is a good alternative? I currently found a work-around using underscore, but underscore has a jquery dependency, so I'm confused how jQuery gives me an error, but underscore works.

Eric Leroy
  • 1,830
  • 1
  • 18
  • 31
  • 1
    isn't it indexOf() working? – A. Wolff Jun 01 '13 at 15:02
  • [Lo-Dash](http://lodash.com/) provides a very nice collection of functions, [`_.contains()`](http://lodash.com/docs#contains) being one of them. – Tomalak Jun 01 '13 at 15:07
  • Tomalak, I have just installed the mrt package for underscore, and that seems to be working. Why do you recommend Lo-Dash over Underscore? – Eric Leroy Jun 01 '13 at 15:42

1 Answers1

0

Underscore comes shipped with meteor: Meteor uses it.

If you want to use JQuery on the server, try Phantom.js. See Server-side jquery

Community
  • 1
  • 1
Fallexe
  • 596
  • 2
  • 11
  • Phantom.js seems like massive overkill if OP just wants to access jQuery's helper methods. – Zach Apr 13 '14 at 21:31