liquid_feedback_frontend

view static/js/xhr.js @ 1618:2f9e1e882de6

Add/remove interest via fetch
author bsw
date Mon Feb 01 23:43:54 2021 +0100 (2021-02-01)
parents
children 62856200414d
line source
1 function toggleInterest(issue_id, iconElId) {
2 var iconEl = document.getElementById(iconElId);
3 var interested = iconEl.innerHTML == "star_outline";
5 var data = new FormData();
6 data.append("issue_id", issue_id);
7 data.append("interested", interested);
9 fetch("/lf/interest/xhr_update", {
10 method : "POST",
11 body: data
12 }).then(
13 response => {
14 if (response.status == 200) {
15 iconEl.innerHTML = interested ? "star" : "star_outline";
16 }
17 }
18 );
20 }

Impressum / About Us