jquery - preventing form submision and submiting form on success function ajax -
i have problem submiting form in success .,.. function? in ajax doesn't work. code:
$("#settings_submit_button").on('click',function(evt){ var settings_email = $("#settings_new_email").val(); var current_password = $("#current_password").val(); evt.preventdefault(); if($("#settings_current_email").val() != '') { if(validateemail($("#settings_new_email").val())) { $.ajax({ type: 'post', url: 'ajaxchecker.php', data: {settings_email :settings_email, current_password: current_password}, success: function(data) { var response = $.trim(data); if(response == 'notright') { $("#settings_loader2").text("zadali ste nesprávne heslo"); } else if(response == 'taken') { $("#settings_loader2").text("email je obsadený"); } else { $("#settings_loader2").empty(); $("#1").submit(); } } }); } else { $("#settings_loader2").text("email je v nesprávnom tvare"); } } });
i have same issue guy
form not submitting inside $.ajax success function
1 -> id of form
$("#settings_loader2").empty(); -> works
$("#1").submit(); -> not work
what this shit checkes if email taken or not right format using ajax . code checked on www.jshint.com .-.. contains no errors
using id's integers it's not way have, anyway should check id @ form have same submit call.
please share html future help, right code seems ok.
- do proper verifications in 'ajaxchecker.php' post on php side don't use var injects real data.
Comments
Post a Comment