在jquery问题中返回Ajax的值

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script>
<SCRIPT type="text/javascript">
$(document).ready(function()
{
    $(".promo").change(function() 
    { 
      var pre_code = $(".promo").val();
      var msgbox = $("#status");
      $('#pre').html(pre_code);
     if(pre_code.length > 4)
     {
       $("#status").html('<img src="loader.gif" align="absmiddle">&nbsp;Checking availability...');


 $.ajax({  
    type: "POST",  
    url: "promo_chk.php",  
    data: "pre_code="+ pre_code,  
    success: function(msg){  
         if(msg == 'msg')
         { 

          $(".promo").removeClass("red");
          $(".promo").addClass("green");
          $("#status").html(msg);
         }  
         else
         {  
          $(".promo").removeClass("green");
          $(".promo").addClass("red");
          $("#status").html('iNVALID');
         }    

      } 

  }); 

}
else
{
  $(".promo").addClass("red");
  $("#status").html('<font color="#cc0000">Please Enter atleast 5 letters</font>');
}
return false;
});

});
</SCRIPT>

promo_chk.php

<?php
require '../db-connect.php';
if(isset($_POST['pre_code']) && !empty($_POST['pre_code'])){
  $precode=mysql_real_escape_string($_POST['pre_code']);
  $query="select * from prepaid where c_code='$precode'";
  $res=mysql_query($query);
  $count=mysql_num_rows($res);

  if($count > 0){
    echo 'msg';
  }else{
    echo 'Invalid';
  }

}
?>

I don't get if statement true. I have checked the message value in else it gives the value same as that checked in 'if' but only else is displayed i.e "if(msg=='true') display "hello" else display msg. " it is going to else and displaying msg content 'true'