jQuery Ajax form submit, to call php login script

Posted by Stevie Jenowski on Stack Overflow See other posts from Stack Overflow or by Stevie Jenowski
Published on 2010-05-19T08:20:01Z Indexed on 2010/05/19 8:50 UTC
Read the original article Hit count: 238

Filed under:
|
|
|
|

Thanks for checking out my problem... I'm having trouble submitting a login form via Ajax for a php script to run and return a new set of html items which will be replacing the HTML in #userlinks.... heres what I have so far

$("#login_form").submit(function() { return false; });

$('#login_button').click(function(event) {
    $form = $(this).parent("form");
    $.post($form.attr("action"), $form.serialize(), function(data){
        $('#userlinks').html(data);
    }); 
});

The php script checks for post data of username && password, yet all I'm getting is a page refresh and no changes. Nothing returns unless I turn login_button into a link and change the script a bit... Any help would be appreciated!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript