Unexpected end of json input
I am making a request to a php file, and the php file should send back a json encoded array, but I'm getting unexpected end of json input for some reason. Here is the JS and the PHP:
//Get Account Information
function GetAccountInfos()
{
fetch("account_functions.php?action=1", {
method: 'post',
headers: {
"Content-Type": "application/json"
}
})
.then(response => response.json())
.then(data => {
if (data !== null)
{
console.log(data);
document.getElementById('account_info_username').value = data["username"];
document.getElementById('account_info_website').value = data["website"];
document.getElementById('account_info_email').value = data["email"];
document.getElementById('account_info_realname').value = data["realname"];
}
})
.catch(error => {
console.error(error);
})
}//Get Account Information
function GetAccountInfos()
{
fetch("account_functions.php?action=1", {
method: 'post',
headers: {
"Content-Type": "application/json"
}
})
.then(response => response.json())
.then(data => {
if (data !== null)
{
console.log(data);
document.getElementById('account_info_username').value = data["username"];
document.getElementById('account_info_website').value = data["website"];
document.getElementById('account_info_email').value = data["email"];
document.getElementById('account_info_realname').value = data["realname"];
}
})
.catch(error => {
console.error(error);
})
}