jQuery Validation unable to read my remote message and displayed incorrect CSS

jQuery Validation unable to read my remote message and displayed incorrect CSS

I'm using jQuery Validation to checking the username availability. I'm able to check the username but when the username existed in database it won't show my error message. Also if you are insert the existed username on the username field it will display the error but if you continue to try another username the error style are become none. 

I have attached the screencast for viewing my error.  http://www.screencast.com/t/hQdRev1HOnh

Also this is my script. 
  1. <script>
  2.             $(document).ready(function() {

  3.                 //* boxes animation
  4.                 form_wrapper = $('.login_box');
  5.                 function boxHeight() {
  6.                     form_wrapper.animate({marginTop: (-(form_wrapper.height() / 2) - 24)}, 400);
  7.                 }
  8.                 ;
  9.                 form_wrapper.css({marginTop: (-(form_wrapper.height() / 2) - 24)});
  10.                 $('.linkform a,.link_reg a').on('click', function(e) {
  11.                     var target = $(this).attr('href'),
  12.                             target_height = $(target).actual('height');
  13.                     $(form_wrapper).css({
  14.                         'height': form_wrapper.height()
  15.                     });
  16.                     $(form_wrapper.find('form:visible')).fadeOut(400, function() {
  17.                         form_wrapper.stop().animate({
  18.                             height: target_height,
  19.                             marginTop: (-(target_height / 2) - 24)
  20.                         }, 500, function() {
  21.                             $(target).fadeIn(400);
  22.                             $('.links_btm .linkform').toggle();
  23.                             $(form_wrapper).css({
  24.                                 'height': ''
  25.                             });
  26.                         });
  27.                     });
  28.                     e.preventDefault();
  29.                 });
  30.                 //* validation
  31.                 $('#login_form').validate({
  32.                     onkeyup: false,
  33.                     errorClass: 'error',
  34.                     validClass: 'valid',
  35.                     rules: {
  36.                         username: {required: true, minlength: 3},
  37.                         password: {required: true, minlength: 3}
  38.                     },
  39.                     highlight: function(element) {
  40.                         $(element).closest('div').addClass("f_error");
  41.                         setTimeout(function() {
  42.                             boxHeight()
  43.                         }, 200)
  44.                     },
  45.                     unhighlight: function(element) {
  46.                         $(element).closest('div').removeClass("f_error");
  47.                         setTimeout(function() {
  48.                             boxHeight()
  49.                         }, 200)
  50.                     },
  51.                     errorPlacement: function(error, element) {
  52.                         $(element).closest('div').append(error);
  53.                     }
  54.                 });
  55.                 $('#reg_form').validate({
  56.                     onkeyup: false,
  57.                     errorClass: 'error',
  58.                     validClass: 'valid',
  59.                     rules: {
  60.                         reg_username: {
  61.                             required: true,
  62.                             minlength: 3,
  63.                             remote: {
  64.                                 url: "check_username.php",
  65.                                 type: "post"
  66.                             }
  67.                         },
  68.                         message: {
  69.                             reg_username: {remote: jQuery.format("{0} is already in use")}
  70.                         },
  71.                         reg_password: {required: true, minlength: 3}
  72.                     },
  73.                     highlight: function(element) {
  74.                         $(element).closest('div').addClass("f_error");
  75.                         setTimeout(function() {
  76.                             boxHeight()
  77.                         }, 200)
  78.                     },
  79.                     unhighlight: function(element) {
  80.                         $(element).closest('div').removeClass("f_error");
  81.                         setTimeout(function() {
  82.                             boxHeight()
  83.                         }, 200)
  84.                     },
  85.                     errorPlacement: function(error, element) {
  86.                         $(element).closest('div').append(error);
  87.                     }
  88.                 });
  89.             });
  90.         </script>

This is my check_username.php source.
  1. include('../inc/dbconn.php');

  2. if (isset($_POST['reg_username'])) {
  3.     $reg_username = mysql_real_escape_string($_POST['reg_username']);
  4.     $check_for_username = mysql_query("SELECT username FROM customers_register WHERE username='$reg_username'");
  5.     if (mysql_num_rows($check_for_username)) {
  6.         echo 'false';
  7.     } else {
  8.         //No Record Found - Username is available
  9.         echo 'true';
  10.     }
  11. }