<?php session_start(); echo json_encode($_SESSION); ?>
fetch('session.php', {credentials: "same-origin"}) .then(response => response.json()) .then(data => console.log(data));