我正在使用Ajax来测试注册表单上的用户名是否太短。如何防止基于PHP值提交表单?
现在它只是做到这一点:
if (str.length<6)
{
document.getElementById("txtHint").innerHTML="Too short";
return;
}
如何添加上面的操作不会让用户提交?
<form action="/insert/insert-user.php" method="post">
<input type="text" name="user" onkeyup="showHint(this.value)"/>