JSON.parse:使用AJAX时出现意外的字符错误

I have a problem with AJAX. I am trying to make a registration page and see if a username is already taken. This is the .js that throws the error when I'm trying to JSON.parse:

function foglaltE() {
    var felhnev = $('username').value;
    ajax( {
        url: 'regell.php',
        getadat : 'username=' + felhnev,
        siker: function (xhr, text) {
            var valasz = JSON.parse(text);
            $('spanfoglalt').innerHTML = valasz.foglalt 
                ? 'Foglalt felhasználónév :('
                : 'Szabad felhasználónév';
        }
    });
}

and this is the php:

$felhnev = trim($_GET['username']);
    $email = $_GET['email'];
    $expr = '_*@_*';
    $jelszavak = fajlbol_betolt('jelszavak.json');

    $reg = array();
    $reg['foglalt'] = array_key_exists($felhnev, $jelszavak)? true : false;
    $reg['email'] = preg_match($expr, $email)==1 ? true : false;

    echo json_encode($reg);

as I understand there is a problem with $reg I am trying to send, but I don't see where