fetch('session.php', {credentials: "same-origin"}) .then(response => response.json()) .then(data => console.log(data));