mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-12-02 03:24:46 +01:00
Solve bug in search
This commit is contained in:
@@ -4,9 +4,9 @@ function initModal(target, url, content_id = 'form-content', always_refetch = fa
|
|||||||
let modalBody = document.querySelector("#" + target + "Modal div.modal-body")
|
let modalBody = document.querySelector("#" + target + "Modal div.modal-body")
|
||||||
|
|
||||||
if (!modalBody.innerHTML.trim() || always_refetch) {
|
if (!modalBody.innerHTML.trim() || always_refetch) {
|
||||||
if (url instanceof Function) url = url()
|
let finalUrl = (url instanceof Function ? url() : url);
|
||||||
|
|
||||||
fetch(url, {headers: {'CONTENT-ONLY': '1'}})
|
fetch(finalUrl, {headers: {'CONTENT-ONLY': '1'}})
|
||||||
.then(resp => resp.text())
|
.then(resp => resp.text())
|
||||||
.then(resp => new DOMParser().parseFromString(resp, 'text/html'))
|
.then(resp => new DOMParser().parseFromString(resp, 'text/html'))
|
||||||
.then(res => modalBody.innerHTML = res.getElementById(content_id).outerHTML)
|
.then(res => modalBody.innerHTML = res.getElementById(content_id).outerHTML)
|
||||||
|
|||||||
Reference in New Issue
Block a user