// controllers/search_controller.js import { Controller } from "stimulus" export default class extends Controller { static targets = [ "query", "results" ] search(){ var searchString = this.queryTarget.value fetch(this.data.get("url")+"?query="+searchString) .then(response => response.text()) .then(html => { this.resultsTarget.innerHTML = html } } }