javascript - Form not submitting even no errors and OK response -


i'm stuck returning.

i need if response "ok", form submitted else document wouldn't reload.

i've tried that:

$(window).load(function(){ $('.check-connection').click(function(){     u = {};     u["host"] = $('[name="host"]').val();     u["db_user"] = $('[name="db_user"]').val();     u["db_pass"] = $('[name="db_pass"]').val();     u["db_name"] = $('[name="db_name"]').val();     $.post('check-connection.php',{secure:true,data:u}).done(function(r){         if(r == "ok"){             /*                 here problems returns ok                 alert(r); - gives answer ok if trying check..             */             return true;         } else {             alert(r);             return false;         }     });     return false; }); 

});

any ideas? offers?

probably might want remove last return false; because returning before ajax completes.

let return when .done() handler executed.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -