使用AJAX提交HTML 5表单? [英] Submit a HTML 5 Form with AJAX?
问题描述
我在使用ajax提交表单时遇到了一些麻烦。
I got some trouble submitting a form with ajax.
由于HTML5表单已在输入标记内进行必需验证,因此无需进行javascript验证检查。但是,正因为如此,我不知道如何使用javascript(jQUERY)在这些验证检查通过后提交表单。换句话说,我怎么知道验证检查是否已经过去了?
Since HTML5 Form already have "required" validation within the input tag, there is no need for javascript validation check. However, because of that, I don't know how to use javascript(jQUERY) to submit a form AFTER those validation checks have been passed. In other words, how do I know whether the validations checks has passed or not?
例如:
??条件?? (在加载提交的页面之前我应该放什么条件)?
(div)。load(finishSubmittingForm.html)
)};
e.g : ??condition?? (What condition should I put before loading the submitted page)? ("div").load(finishSubmittingForm.html) )};
任何想法?
谢谢
推荐答案
有一些API方法可用。请参阅 developer.mozilla.org 。
There are some API methods available. See developer.mozilla.org.
但是,我强烈建议您在依赖HTML5验证之前仔细考虑。它在这个时间点肯定有一些主要的缺点,因为它仍处于婴儿时期。我想说现在,你最好使用JS验证库; jQuery验证 非常好。
However, I would strongly advise you think carefully before relying on HTML5 validation. It definitely has some major drawbacks at this point in time, as it is still "in its infancy". I would say that for now, you would be better off using a JS validation library; jQuery Validation is excellent.
这篇关于使用AJAX提交HTML 5表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!