title: Javascript Class - undefined is not a function when calling function
body: <p>I´m trying to program OO in javascript. There are several variants of doing this.</p>
  
  <p>I have seen something I think in some AnglularJS examples which is for me the clearest one.</p>
  
  <p>Sadly I´m getting </p>
  
  <blockquote>
    <p>undefined is not a function</p>
  </blockquote>
  
  <p>when calling a function of my instance</p>
  
  <pre><code>var MyChooser = (function () {
  
      var self = this;
      var constructor = function (selectBox, previewBox) {
          this.selectBox = selectBox;
          this.previewBox = previewBox;
          this.selectBox.change(function () {
              alert(this.value);
          })
      };
  
      MyChooser.prototype.loadFrames = function () {
          alert("load");
          $.ajax({url: "api.php"}).done(function (data) {
              alert(data);
              //self.frames = data;
          })
      };
  
      MyChooser.prototype.displayFrame = function (frame) {
          this.previewBox.setAttribute("src", frame.src);
      };
  
      MyChooser.prototype.invalidateSelectBox = function () {
  
      };
  
      return constructor;
  });
  
  
  
   var fp = new MyChooser(document.getElementById("frame-select"), document.getElementById("frame-preview"));
              fp.loadFrames();
  </code></pre>
  
  <p>Why do I get this error?</p>
  
  <p>(I also removed the jquery calls, but it is not the problem)</p>