我正在使用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)"/>