You will have no control over the submit action unless the onsubmit event returns true or false. So, to begin with you should do this:
Code:
onsubmit="return checking_valid_then_checking_ajax();"
Now, let's look at what happens in your function. If u or p are empty, it returns false. Otherwise it hands over to cheking_ajax() and returns undefined. I can't see what cheking_ajax() does. It should be setup to return true or false, ex:
Code:
function cheking_ajax(){
if (something)
return true;
alert('no ajax');
return false;
};
or:
Code:
function cheking_ajax(){
if (something){
alert('no ajax');
return false;
}
return true;
};
If it is like one of those (the alerts are optional), then your checking_valid_then_checking_ajax() function can be:
Code:
function checking_valid_then_checking_ajax(){
if(document.myform.u=="" || document.myform.p==""){
alert('please complete form!');
return false;
}
return cheking_ajax();
}
and it should all work out. But your cheking_ajax() may hand off to yet another function, if it does, then it must return a value of true or false as derived from that function.
Bookmarks