Submit HTML 5 form with AJAX?

I am having trouble submitting a form using ajax.

Since the HTML5 form already has the “required” validation in the input tag, there is no need to validate JavaScript validation. However, because of this, I do not know how to use javascript (jquery) to submit the form AFTER these validation checks pass. In other words, how do you know if validation checks passed or not?

for example: ?? state ?? (What condition should I put before loading the submitted page)? ("Div"). Loads (finishSubmittingForm.html))};

Any idea?

thank

+5
source share
2 answers

API. . developer.mozilla.org.

, HTML5. , " ". , JS; jQuery Validation .

+3

:

. , , .

, ajax.

$('form').bind('submit', function(){
    //Ajax implementation here
});

Opera . Opera , .

, HTML5. :

$('form').bind('submit', function(){
    if(!this.checkValidity || this.checkValidity()){
        //Ajax implementation here
    }
});

HTML5. , spec. , FF4 (FF4 , Opera Chrome, ) .

HTML5 , webshims HTML5 polyfill. , , . , Opera, , .

+2

All Articles