summaryrefslogtreecommitdiff
path: root/app/javascript/controllers/activity_select_controller.js
blob: 2acfcddbc9bcd36a60a05f6f39814c0f5a54ee27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { Controller } from "stimulus";

export default class extends Controller {
  static targets = [ "select", "output" ];

  connect() {
    this.load();
  }

  load() {
    fetch(`/activities/${this.selectTarget.value}/costs_and_requirements`)
      .then(response => response.text())
      .then(html => {
        this.outputTarget.innerHTML = html;
      });
  }
}