要求用户在HTML表单中输入值。然后用JS验证表单的值,如果不正确,请用户进行更正。如果所有JS都执行顺利然后使用PHP提交HTML表单
考虑如下表单:
<form id="myForm" method="POST" action="monSite/path/to/route">
//Form fields here
</form>
然后javascript:
$('#myForm').on('submit', function(e)
{
//put your validation logic here
if(isFormNotValid)
{
//display an error and then
//prevent the form from being sent
e.preventDefault();
}
});
我不明白你说的"用PHP提交html表单"是什么意思