hello members,
i have wriiten a form in my php page and i did call an ajax function on onsubmit, based on my ajax response my form have to be submit...but i am not getting ajax response text some times. But some times i got it correctly..i have used post method in my ajax function.
please check the code and do fix my problem.
formid="reserve";
var f = document.getElementById(formid);
var keyValue = "";
keyValue = buildKeyValueSearchFunction(f, keyValue);
alert(keyValue);
ajax_request = createRequestObject();
ajax_request.open('POST', 'checkpaycycle.php' , true);
ajax_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
alert(ajax_request.readyState);
ajax_request.onreadystatechange = function()
{
if (ajax_request.readyState == 4 )
{
if(ajax_request.responseText!='')
{
alert(ajax_request.responseText);
document.getElementById("error_pgrid").innerHTML=ajax_request.responseText;
}
}
}
ajax_request.send(keyValue);
return false;
thanks in advance,
SHAN