Javascript と PHP を混同しているようです。これはきれいなコーディングではなく、コードが読めなくなるため、ある時点で後悔することに注意してください。あなたのコードはどこに表示されますか、関数による$_GET変数の問題とはどういう意味ですか?log()
「その後、fontid.innerHTML を null に変更する可能性のある別のものを押すと、$say の値はそのまま残ります」null にならないので、「」のような空の文字列になると思います。 :if($say!=null && $say!='' && $reg=="log")
少しトピックから外れていますが、全体的に役立つかもしれません。クリーンアップのアプローチは次のようになりajax.phpます$_POST['action']。
すべての戻り値は json_encoded である必要があるため、処理する必要があるデータは戻り時に常に同じように見えます。そのためにこの関数を使用します:
function jsondie($status, $array, $jsoutput){ 
    if(!is_array($array)) { jsondie('error', 'Not an array!', $array); }
    $return_values = array('status' => $status, 
                    'data' => $array,
                    'jsoutput' => $jsoutput);
    return json_encode($return_values);
}
(例) jquery $.ajax を使用して JavaScript を作成しdataType: 'json' 
、返されたデータで簡単に確認できます。
jQuery.ajax("ajax.php", dataType: 'json', { action: 'login', username: username, password: password, captcha: captcha },
    function(ajaxdata) {
        if(typeof(ajaxdata.status)=='undefined') { 
            alert('error in your ajax function'); 
            // push that stuff to f12 console for firebug + chrome
            try { console.log(ajaxdata); } catch(e){}
            return false;
        } else if (ajaxdata.status == 'error'){
           // write it to some error dialog or field here 
           fontid.innerHTML = '<span class="error">'+ajaxdata.data+'</span>';
           // flush the returned data to the console
           try { console.log(ajaxdata.jsoutput); } catch(e){}
        } else {
           // all fine, write or do something on success
           //window.location = 'loggedin.php';
           fontid.innerHTML = ajaxdata.data; // this is the data coming from ajax.php
        }
    }
たぶん、これはあなたや他の誰かがあなたの計画されたプロジェクトのためのよりクリーンなアプローチを得るのに役立ちます:-)
マックス