Ajax form does not work -


im trying create login page use form:

<form method="post" id="foo" action="http://******/auth/signin">         <input type="text" name="username" />         <input type="password" name="password" />         <input type="checkbox" name="rememberme" />   <input name="submit" type="submit" value="submit"> </form> 

this work fine, redirects next page want avoid take use of ajax:

$(function() { $('#foo').submit(function() {     $.ajax({         type: $(this).attr('method'),         url: "http://******/auth/signin",         data: $(this).serialize(),         success: function(responsetext) {             $('#result').html(responsetext);             alert("hey");         }     });     return false; // important: prevent form submitting }); }); 

now have removed action part form tag in html shown earlier. doesnt alert("hey");. can tell why isnt working?


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -