$.each problem illegal character at the end of each

$.each problem illegal character at the end of each

guys im having trouble on getting all the data in the table. someone suggested me to use $.each() function but my firebug keep on giving me illegal character on the }); at the end of the $.each(). i checked if i supply the correct number of }); and they all have the sufficient supply of });  here is the code

HTML:

<div id="wrap-body">

    
    <form action="" method="post">
      <input type="text" name="username" id="username">

      <input type="text" name="msg" id="msg">

      <input type="button" id="submit" value="Send">

    </form>


    <div id="info">


    </div>
  </div> 


JS:

<script>


$(document).ready(function (){

     


  $('#submit').click(function (){
     var username = $('#username').val();
      var msg = $('#msg').val();

     $.ajax({
                type: 'POST',
                url: 'get.php',
                dataType: 'json',
                data:{'username': username, 'msg':msg},
                success: function (data){

                   $.each(data, function(i,item) {

                     $('#info').append("<p> you are:"+data[item].username+"</p> <p> your message  is:"+data[i].mesg);

                   });​

                }
            });
  });

});

</script>


PHP : 

<?php

$host='localhost';
$username='root';
$password='12345';
$db = 'feeds';



$connect = mysql_connect($host,$username,$password) or die("cant connect");
mysql_select_db($db) or die("cant select the".$db);


$username = $_POST['username'];

$msg = $_POST['msg'];

$insert = "INSERT INTO info(user_name,message) VALUES('$username','$msg')";

if(@!mysql_query($insert)){

die('error insertion'.mysql_error());

}


$get = "SELECT * FROM info ";

$result=mysql_query($get)or die(mysql_error());



$inside_counter =   mysql_num_rows($result);




$data=array();
while ($row = mysql_fetch_array($result))
{
$data[] = array(
   'username'=>$row['user_name'],
   'mesg'=>$row['message'],
   'counter'=>$inside_counter
);
}

echo json_encode($data);



?>