Using $.post to authenticate user to return custom error / success message
<p>I am having this jQuery to authenticate users into site, how can I make two actions for success/error returned by login.php? Is it possible to refresh the page on success (for example) and post error message if the login info was not successful in login.php. I hope my question is clear. Here is the code. Right now it just paste the data output from login.php and I do not know how to seperate success/error returned server side.</p>

<pre><code>$("#form-login").submit(function(event) {
    event.preventDefault();
    var $form = $( this ),
        log = $form.find( 'input[name="log"]' ).val(),
        pwd = $form.find( 'input[name="pwd"]' ).val(),
        rememberme = $form.find( 'input[name="rememberme"]' ).val();
    $.post( '/ajax/login.php', { log: log, pwd: pwd, rememberme: rememberme },
        function(data) {
            $(".form-login-status").html(data);
        }
    );
});
</code></pre>
