Can't Get Collection Data to Display

I can’t see where I’m going wrong. The list of websites does’t display.

// shared code
Websites = new Mongo.Collection("websites");

if (Meteor.isClient){
        button... you need to compete it
     'click #js-add-site':function(event){
         var url = $('#url_input').val();// get the form value using jquery...
         var site = {"url":url};
		 // console.log(site);
         return false;

            return Websites.find().fetch();



    <div class="container">
        <h1>Welcome to Site Ace!</h1>
        Fill in the form and click submit to add a site:

<template name="siteList">
    <h3>Sites you have added:</h3>
    {{#each all_websites}}

<template name="addSiteForm">
<div class="row">
  <div class="col-lg-6">
    <div class="input-group">
      <input type="text" id="url_input" class="form-control" placeholder="Enter website URL...">
      <span class="input-group-btn">
        <button class="btn btn-default" id="js-add-site" type="submit">Add!</button>
    </div><!-- /input-group -->
  </div><!-- /.col-lg-6 -->

Assuming you are using the insecure package, which allows you to write directly from the client, and the autopublish package, which allows you to autosubscribe to all data, then I think your fix is here:

{{#each all_websites}}

When you’re looping through a .find() or a .find().fetch(), you need to ask for the props of the object.

1 Like

Putting the spacebars in an anchor tag like this

 <li><a href="">{{url}}</a></li>

then clicking the link in the browser seems just I refresh the browser instead of going to the link.

In your code snippet, it doesn’t appear that you’re setting the href…