title: Vanilla JS MVC -- Notify controller from model when AJAX succeeds
body: <p>I am struggling with my first vanilla JS MVC app. My model makes an AJAX request to the server ... and then the controller updates the view, but it doesn't wait for the AJAX promise to resolve, so it just updates the view with nothing. How can I notify the controller of async resolves?</p>
  
  <p>Controller:</p>
  
  <pre><code>function DeadController() {
          this.model = new DeadModel();
          this.view = new DeadView();
          this.updateView();
      }
      DeadController.prototype.updateView = function() {
          this.view.render(this.model.data);
      }
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>function DeadModel() {
      this.uri = 'api' + window.location.pathname;
      this.data = this.getResponse(this.uri);
  }
  DeadModel.prototype.getResponse = function(uri) {
      $.get(uri, (response) =&gt; {
          return response;
      });
  }
  </code></pre>