Uncaught SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at xhr.onload (settings.php:169:37)
function get_general() {
let site_title = document.getElementById('site_title');
let site_about = document.getElementById('site_about');
let shutdown_toogle = document.getElementById('shutdown-toogle');
let xhr = new XMLHttpRequest();
xhr.open("GET", "ajax/settings_crud.php", true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onload = function() {
general_data = JSON.parse(this.responseText);
site_title.innerText = general_data.site_title;
site_about.innerHTML = general_data.site_about;
site_title_inp.value = general_data.site_title;
site_about_inp.value = general_data.site_about;
if (general_data.shutdown == 0) {
shutdown_toogle.checked = false;
shutdown_toogle.value = 0;
} else {
shutdown_toogle.checked = true;
shutdown_toogle.value = 1;
}
}
xhr.send('get_general');
}
New contributor
Indra Maulana is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1