Hi,
Seems like you have basic misunderstanding about Ajax. You are making synchronous calls, not "A"synchronous calls.
Second thing I want to say is, there is no need for callbacks if you are using synchronous calls. You unnecessarily complicated the code by having those callbacks for synchronous requests.
function valCheck(url)
{
//url is
servlet that inturn query a database a returns a value
request = createRequestObject();
request.onreadystatechange = onResponse;
request.open("POST", url, false);
request.send(url);
if( request.status == 200 ) {
var str = request.responseText;
// do whatever you are doing in callback handler.
}
else {
//write error handling code here.
}
If you really mean to use asynchronous calls, then change your submit button to normal button and onclick process the asynchronus call and submit form once you get confirmation from server.