07/03/2018
(function () {
document.querySelectorAll('.btn-profile-add').forEach(function(btn)
{
btn.addEventListener("click", async function(){
var mod = this.getAttribute('data-module')
var data = {
"action": "add",
"module": mod,
"name": "default"
}
await fetch("http://portail.home/ajax/modules.php", {
"method": "POST",
credentials:'same-origin',
"headers": {
"content-type": "application/json"
},
"body": JSON.stringify(data)
})
.then(async function(response) {
const json = await response.json();
console.log(json)
})
.catch(err => {
console.log(err);
});
})
})
})();