javascript - Form submit true when another function true (jquery) -
javascript - Form submit true when another function true (jquery) -
i have form event on submit. submit form when function (first) true.
$("#form_id").submit(function () { if ---------------- { homecoming true; } else { homecoming false; } }); and function:
function (first) { homecoming true }
based on comments, utilize success setting jquery's ajax offers submit().
for example, embody submit() within function:
function sendmystuff(){ $("#form_id").submit(function () { /// }); } then in ajax's success event, phone call it:
$.ajax({ /// success: sendmystuff }); however, if want way, seek exact opposite of described above. enclose ajax in function returns true, , phone call within submit() event.
edited:
$("#form_id").submit(function (event) { if(somefunction()){ /// } else { /// } event.preventdefault(); }); javascript jquery function
Comments
Post a Comment