having issues with a form trying to use jquery to ajax only the $the_message field to avoid browser refresh
<p>I want to avoid the browser refresh and get to display only the message without the browser refresh. </p>

<pre><code>    $idc = $_GET['id'];
    $name1 = $_GET['name'];
    $id2 = $_GET['ids'];
     if ($_POST['message_field'] != ""){
        $message_field = $_POST['message_field'];

          $sql = mysql_query("INSERT INTO comment (mem_id,commented_men_id, message, message_date) 
         VALUES('$userid','$idc','$message_field', now())")  
         or die (mysql_error());

    }

        $sql_message = mysql_query("SELECT id, mem_id ,message, message_date FROM comment WHERE mem_id='$userid'  ORDER BY message_date DESC");

        while($row = mysql_fetch_array($sql_message)){


            $id = $row["id"];
            $me_id = $row["mem_id"];
            $json = $row["message"];
                 $message_date = $row["message_date"];
                $message = json_encode($json);

 $sql_mem_data = mysql_query("SELECT id, name FROM users WHERE  id='$me_id'");
              while($row2 = mysql_fetch_array($sql_mem_data)){
                $id = $row2["id"];
                $ufirstname = $row2["name"];
        }

    $messageList .= '&lt;div id="only"&gt;&lt;p&gt;' . ufirstname . '&lt;/p&gt;&lt;br/&gt;&lt;p    id="pmessage"&gt;'.$the_message.'&lt;/p&gt;&lt;/div&gt;';

    }

    &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
    &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
    &lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
    &lt;title&gt; Book&lt;/title&gt;
    &lt;link rel="stylesheet" href="style/style.css" type="text/css" media="screen" /&gt;
    &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="jquery.form.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="mootools-core-1.3.2-full-compat.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;
    $(document).ready(function(){

       $("#messageinput").click(function() {
           $.post($('#message').attr("action"),
                  $("#message").serialize(),
                  function(html) {
                    var comment = $(html) .find('#messageoutput').html();
                      $("#pmessage").html(comment);
              });
   });
       });

    &lt;/script&gt;
         &lt;div id="messageid"&gt;
             &lt;form align="left" id="message" action="&lt;?php profile.php?id='.$idc.'&amp; ids='.    $id2.'&amp;name='.$name1.'?&gt;" method="post" enctype="multipart/form-data" name="blab_from"&gt;
        &lt;textarea name="message_field" rows="3" style="width:97%;"&gt;&lt;/textarea&gt;
         &lt;input id="messageinput" name="submit" type="button" value="submit" align="left" /&gt;
        &lt;/form&gt;
        &lt;/div&gt;
        &lt;div id="messageoutput"&gt;&lt;?php print "$messageList"; ?&gt;&lt;/div&gt;
</code></pre>

<p>Table structure</p>

<pre><code>CREATE TABLE IF NOT EXISTS `blabbing` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `mem_id` int(11) NOT NULL,
  `commented_men_id` int(11) NOT NULL,
  `the_message` varchar(255) NOT NULL,
  `sub_commented_id` int(11) NOT NULL,
  `message_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `type` varchar(50) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=146 ;
</code></pre>
