如果表单有效,则更改jQuery post结果

The title may seem a bit confusing, but let me just tell you what I am trying to do. So I have a registration form in register.php. The form data is processed by my register.class.php file on a keyup by the user, and any errors in the submitted data are then returned and put into a "#return" div (in register.php).

The "#return_error" is echoing just fine, I'm having no problems echoing that, but for some reason, even if there are no errors, the "#return_success" won't echo.

I'm fairly new to jQuery, so please forgive me.

Here are the files:

register.class.php

//this is just an excerpt from the file, the rest of the code in the file was just validation. 

$register = new Register();
$username = $_POST['username'];
$email1 = $_POST['email'];
$email2 = $_POST['reemail'];
$pass1 = $_POST['pass'];
$pass2 = $_POST['repass'];

$register->Username($username, $mysqli);
$register->Email($email1, $email2, $mysqli);
$register->Password($pass1, $pass2);

// no errors are found
if ($register->getStatus() === true) {

    echo "<div id=\"return_success\">";
    echo "<ul>";
    echo "<li><b>Everything is valid</b></li>";
    echo "</ul>";
    echo "</div>";
} else {
    //errors found
    echo "<div id=\"return_error\">";
    echo "<ul>";
    foreach ($register->errors as $error) {
        echo "<li><b>" . $error . "</b></li>";
    }
    echo "</ul>";
    echo "</div>";
}

script.js

 $(document).ready(function() {
$("#return").hide();
$("#register input").keyup(function() {
    $.post("classes/register.class.php", $("#register").serialize(), function(data) {
        $("#return").html(data);
        $("#return").show();
        if (data === '') {
            $("#return").hide();
        }
    });        
});

});