1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| export async function filtrerOnglets(url) {
try {
let response = await fetch(url, {
method: "GET",
cache: "no-cache",
headers: {
"X-Requested-With": "XMLHttpRequest",
"Content-Type": "Application/json",
},
});
let data = await response.json();
tabContent.innerHTML = data.content;
let pagination = document.querySelectorAll(".tabs__content span a");
//filtrage pour pagination
pagination.forEach((el) => {
el.addEventListener("click", (e) => {
e.preventDefault();
let urlPagination = e.target.getAttribute("href");
async function paginationAjax() {
let response = await fetch(urlPagination, {
method: "GET",
cache: "no-cache",
headers: {
"X-Requested-With": "XMLHttpRequest",
"Content-Type": "Application/json",
},
});
let data = await response.json();
tabContent.innerHTML = data.content;
}
paginationAjax();
console.log(urlPagination);
});
});
} catch (error) {
alert("Erreur " + error);
}
} |
Partager