title: Knockout.JS: get data
body: <p>I know this may seem too easy, but I'm trying to understand how Knockout works. What am I doing wrong ? I need to get, for each student, data about "Note", but the method I've tried doesnt seem to work... I'd appreciate any kind of help or advices.</p>
  
  <pre><code> &lt;table data-bind="foreach: students"&gt;
          &lt;tr&gt;
              &lt;th&gt;ID&lt;/th&gt;
              &lt;th&gt;Nume&lt;/th&gt;
              &lt;th&gt;Prenume&lt;/th&gt;
              &lt;th&gt;Data&lt;/th&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;input type="text" size="1" data-bind="value: StudId" disabled="disabled"&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" size="60" data-bind="value: Nume" disabled="disabled"&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" size="60" data-bind="value: Prenume" disabled="disabled"&gt;&lt;/td&gt;
              &lt;td&gt;
                  &lt;input type="text" size="15" data-bind="value: Data" disabled="disabled"&gt;
                  &lt;input data-bind="click: $parent.deleteStudent.bind($parent, $data.StudId)" type="button" value="Sterge" class="button button1" id="sterge" /&gt;
                  &lt;input data-bind="click: function() { $parent.loadNote.bind($parent, $data.StudId); alert(NotaId); }" type="button" class="button button2" value="Note" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  </code></pre>
  
  <p>And Knockout one:</p>
  
  <pre><code> &lt;script type="text/javascript"&gt;
          var uri = 'api/student';
  
          var StudentsViewModel = function () {
              this.students = ko.observableArray();
              this.note = ko.observableArray();
  
              this.loadNote();
              this.loadStudents();
          };
  
          StudentsViewModel.prototype.loadStudents = function () {
              var self = this;
              $.getJSON(uri, function (data) {
                  self.students(data);
              });
          };
  
          StudentsViewModel.prototype.loadNote = function (id) {
              var self = this;
              $.getJSON(uri + '/' + id, function (data) {
                  self.note(data);
              });
          };
  // Apply bindings
          ko.applyBindings(new StudentsViewModel());
  </code></pre>
  
  <p>Why doesn't it show "Note" when I press the button for each student? </p>