Trejon House February 2016

Error invoking Method 'filterMulitpleTags': Internal server error [500]

I dont understand why i am getting this Internal server error 500. Also because of the items aren't being hidden as i want them to. The console output is saying that the '$' isnt defined which isnt right i dont believe since i am link jquery.

HTML:

<template name="room">
    <div class="container-fluid">
        <h1> Sprint Retrospective</h1>
        <form id="tagSearchForm" class="navbar-form navbar-right" role="search">
          <div class="form-group">
                <span><i class="fa fa-filter"></i></span>
            <input id="filters" type="text" class="form-control" placeholder="Filter tags...">
          </div>
          <button id="filterTagsButton" type="button" class="btn btn-default">Filter</button>
        </form>
        {{> card}}
        <hr>
        <div class="container-fluid">
            <div class="row">
                <div class="col-xs-6 col-sm-6">
                    <h2> Good category </h2>
                    <ul class="fa-ul">
                        {{#each goodCards}}
                            <div class="row">
                                <div id="card" class="card-panel green">
                                    <span class="white-text">
                                        {{text}}
                                    </span>
                                    <div class="card-action">
                                        <div class="chip">
                                            <i id="deleteCardButton" class="material-icons fa fa-trash-o"></i>
                                            Remove Card
                                        </div>
                                        {{#each tags}}
                                            <div class="chip">
                                         

Answers


Stephen Woods February 2016

Meteor methods are defined and executed on the server (also the client, depending on where they're defined). Since the server doesn't have access to jQuery, $ is undefined and it's throwing an error. It looks like you want to just execute some client-side code when something happens. In that case, you're looking for events:

In your client-side js code:

Template.yourTemplateName.events({
    'click #filterTagsButton' (event, template) {
        // Your stuff from your question goes here.
    }
});

I can't tell which one is single versus multiple based on your example, but I think you can get the gist from here. I'd highly recommend reading the Meteor Guide for this kind of thing.

Post Status

Asked in February 2016
Viewed 2,070 times
Voted 11
Answered 1 times

Search




Leave an answer