Код: Выделить всё
/session-test/index.phpКод: Выделить всё
document.querySelector('form').addEventListener('submit', function(event) {
event.preventDefault(); // Prevent the default form submission
var formData = new FormData(this); // Create a FormData object from the form
fetch('/custom/regAjax.php', {
method: 'POST',
body: formData
})
.then(response => response.text())
.then(data => {
alert(data); // Handle the response data
})
.catch(error => {
console.error('Error:', error); // Handle any errors
});
});
< /code>
/session-test/ajax.phpКод: Выделить всё
Подробнее здесь: [url]https://stackoverflow.com/questions/79663667/php-session-data-differs-if-accessed-from-the-root-though-ids-match[/url]
Мобильная версия