mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
22 lines
No EOL
769 B
JavaScript
22 lines
No EOL
769 B
JavaScript
// Create a variable to hold the session ID
|
|
var PHPSESSID = null;
|
|
|
|
// Function to load the session ID via AJAX
|
|
function loadPHPSessionID() {
|
|
fetch(webSiteRootURL + 'objects/phpsessionid.json.php', {
|
|
method: 'GET',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
}
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
PHPSESSID = data.phpsessid; // Assign the session ID to the variable
|
|
console.log('PHPSESSID loaded:', PHPSESSID); // You can remove this in production
|
|
})
|
|
.catch(error => {
|
|
console.error('Error loading PHPSESSID:', error);
|
|
});
|
|
}
|
|
// Load the session ID as fast as possible
|
|
window.addEventListener('DOMContentLoaded', loadPHPSessionID); |