title: How to fetch data from Backbone collection to Template
body: <p>i am just writing a simple backbone program. But i am not getting how to fetch data from backbone collection to backbone template. Complete code is written below:</p>
  
  <pre><code>        &lt;!doctype html&gt;
          &lt;html&gt;
             &lt;head&gt;
                &lt;title&gt;Backbone tutorial&lt;/title&gt;
             &lt;/head&gt;
             &lt;body&gt;
                &lt;div class="user"&gt;user&lt;/div&gt;
                &lt;div class="page"&gt;&lt;/div&gt;
  
                &lt;script type="text/template" id="user-list-template"&gt;
  </code></pre>
  
  <p>I am not able to get data on daya.key</p>
  
  <pre><code>                &lt;h1&gt; &lt;%= data.key %&gt; &lt;/h1&gt;
  
                &lt;/script&gt;
  
                &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;
                &lt;script type="text/javascript" src="underscore.js"&gt;&lt;/script&gt;
                &lt;script type="text/javascript" src="backbone.js"&gt;&lt;/script&gt;
                &lt;script&gt;
  </code></pre>
  
  <p>This is my Collection code</p>
  
  <pre><code>                  var Album = Backbone.Collection.extend({
  
                      url : "/data.json"
                    });
  </code></pre>
  
  <p>This is my view code</p>
  
  <pre><code>                 var UserList= Backbone.View.extend({
                      el:'.page',
                      template:_.template($('#user-list-template').html()),
                      render : function(){
                          var that=this;
                          var album= new Album();
                          album.fetch({
                              success:function(album){
  
                                  var _data = {data : album.models} ;
  
                                  $(that.el).html(that.template(_data));
                              }
                          })
  
  
                      }
  
                   });
  </code></pre>
  
  <p>This is my Router code</p>
  
  <pre><code>                 var Router = Backbone.Router.extend({
                      routes: {
                          "":                 "home"   // #help
                      }
  
  
                   });
  
  
  
                   var userList= new UserList();
                   var router = new Router();
  
                   router.on('route:home', function(){
                      userList.render();
                   });
  
                   Backbone.history.start();
                &lt;/script&gt;
             &lt;/body&gt;
          &lt;/html&gt;
  </code></pre>
  
  <p>and here is the data.json file</p>
  
  <pre><code>{ "key" : "value to print on template "}
  </code></pre>