Skip to content

Instantly share code, notes, and snippets.

@leenasn
Created August 6, 2019 03:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leenasn/9525dc0ab96107e9988765a58f2eab9f to your computer and use it in GitHub Desktop.
Save leenasn/9525dc0ab96107e9988765a58f2eab9f to your computer and use it in GitHub Desktop.
import { Controller } from "stimulus"
export default class extends Controller {
static targets = [ "source", "members" ]
search(){
var searchString = this.sourceTarget.value
fetch(this.data.get("url")+"?query="+searchString)
.then(response => response.text())
.then(html => {
this.membersTarget.innerHTML = html
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment