The jQuery form .submit handler is not working -
i need make ajax request while form being submitted. page should not reloaded. tried attach jquery .submit()
handler reason not work. why?
... $('#login-form').submit(function(){ e.preventdefault(); alert('hi'); .... }); ... <form id="login-form" class="navbar-form" action="" method="get" > <input id="email" class="span2" type="text" placeholder="email"> <input id="password" class="span2" type="password" placeholder="password"> <button type="submit" id="login-btn" class="btn btn-primary">sign in</button> </form >
you forgot e
argument in callback.
$('#login-form').submit(function(){
should be
$('#login-form').submit(function(e){ ^
after should work. if doesn't make sure bind handler either inside document ready event or after form has been defined.
Comments
Post a Comment