$.post and $('form').submit() help please

$.post and $('form').submit() help please

Hi all. I'm new to jQuery. I'm creating a code for user registration which checks if the username and email already exists. I do the checking using php. If the conditions are met, it returns true. It's returning the correct data. Though, I can't seem to get what I want to happen. Can you help me? Here's my code.
    $('#log_info').submit(function(){
        var $form = $('#log_info');
        $.post("./include/checkLogInfo.php"
        , {
         username: $('#username').val(),
         email: $('#email').val()
      }
        , function(data){
            alert(data.success);
            if (data.success == 'true')
                $form.unbind('submit').submit();
        }, "json");
        return false;
    });

this is what I want to happen
$('#log_info').submit(function(){
  if (data == true){ return true; }
return false;
});


here is my php code

<?php

include "../class/controller.php";
$reg = new Register ( );
$reg->dbConnect ();

$username = $_POST ['username'];
$username = trim ( htmlentities ( $username ) );
$email = $_POST ['email'];

if ($email == "" || $username == "") {
   $data ['success'] = 'false';
} else {
   $query = "SELECT * FROM jos_users WHERE username = '" . $username . "'";
   $sql = mysql_query ( $query );
   $check_sql = mysql_num_rows ( $sql ) or die ( mysql_error () );
   $checkmail = explode ( "@", $email );
   
   $data ['success'] = validate ( $check_sql, $checkmail [1] );
}

function validate($sql, $mail) {
   if ($sql > 0 || $mail != 'ucc.ie') {
      return 'false';
   } else {
      return 'true';
   }
}
echo json_encode ( $data );

?>

your help will be very much appreciated. thanks!