$.post worked for me (the redirection is completely accidental and i had to scratch my head for hours to understand why this happened)..
i was not able to understand what your problem is, but i noted a few } mismatches in your code. that should have been $(document).ready(function() { $("#submit_butt").click( function() { // configurations for the buzzing effect. Be careful not to make it too annoying! var conf = { frequency: 5000, spread: 5, duration: 600 }; /* do your AJAX call and processing here...*/ var unameval = $("#username").val(); var pwdval = $("#pwd").val(); $.post("backend.php", { username: unameval, pwd: pwdval }, function(data){ if(data.length >0) { window.location.href("account.php"); } else { // this is the call we make when the AJAX callback function indicates a login failure $("#login").vibrate(conf); // let's also display a notification if($("#errormsg").text() == "") { $("#loginform").append('<p id="errormsg">Nesprávne meno alebo heslo!</p>'); } // clear the fields to discourage brute forcing :) $("#username").val(""); $("#pwd").val(""); } }); }); });