generated from ElnuDev/go-project
Use GET rather than POST for search
This commit is contained in:
parent
d18c9303c6
commit
61c1ce5502
2 changed files with 2 additions and 2 deletions
|
@ -179,7 +179,7 @@ func main() {
|
||||||
query := r.FormValue("q")
|
query := r.FormValue("q")
|
||||||
return initSearchTemplateData(Search(query))
|
return initSearchTemplateData(Search(query))
|
||||||
},
|
},
|
||||||
[]string{http.MethodGet, http.MethodPost},
|
[]string{http.MethodGet},
|
||||||
))
|
))
|
||||||
r.Handle("/", http.FileServer(http.Dir("static")))
|
r.Handle("/", http.FileServer(http.Dir("static")))
|
||||||
log.Fatal(http.ListenAndServe(":3334", r))
|
log.Fatal(http.ListenAndServe(":3334", r))
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<img src="https://jichan.org/logo.svg" style="height: 4em; display: block; margin: 1em auto 1em auto">
|
<img src="https://jichan.org/logo.svg" style="height: 4em; display: block; margin: 1em auto 1em auto">
|
||||||
</a>
|
</a>
|
||||||
<form
|
<form
|
||||||
hx-post="/api/search"
|
hx-get="/api/search"
|
||||||
hx-on::before-request="this.setAttribute('hx-replace-url', `/search/${this.querySelector('input').value}`)"
|
hx-on::before-request="this.setAttribute('hx-replace-url', `/search/${this.querySelector('input').value}`)"
|
||||||
hx-target="#results"
|
hx-target="#results"
|
||||||
hx-swap="innerHTML">
|
hx-swap="innerHTML">
|
||||||
|
|
Reference in a new issue