午前2時の謎が大好きなのと同じくらい、聞いてみるのが一番だと思います。
onblurイベントを使用して「this」を渡します(例:this = input.password)。何らかの理由で、handleServerResponseに行を追加しない限り、handleServerResponseは何もしません。見てください。
通常のajax関数:
function ajaxFunction(obj)
{
var button = document.getElementById("submit");
button.disabled = true;
button.setAttribute("class", "test");
var getdate = new Date(); //Used to prevent caching during ajax call
xmlhttp.onreadystatechange = handleServerResponse(obj);
if(xmlhttp)
{
//var input = document.forms["signup_form"].getElementsByTagName("input");
xmlhttp.open("POST","register_ajax.php",true);
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.send(obj.name +"="+ obj.value);
};
}
handleServerResponse-機能しません
function handleServerResponse(obj)
{
if (xmlhttp.readyState == 4)
{
if(xmlhttp.status == 200)
{
obj.value=xmlhttp.responseText; //Update the HTML Form element
}
else
{
alert("Error during AJAX call. Please try again");
}
}
}
handleServerResponse-仕事の
function handleServerResponse(obj)
{
alert(xmlhttp.responseText);
if (xmlhttp.readyState == 4)
{
if(xmlhttp.status == 200)
{
obj.value=xmlhttp.responseText; //Update the HTML Form element
}
else
{
alert("Error during AJAX call. Please try again");
}
}
}