title: update and show comment without reloading the webpage
body: <p>i have the following jquery code, which is link to a html form which is link to a php script. the form should submit and the jquery code should update the comment and show the comment as if the page was referesh. but nothing happens when i hit submit i cant seem to see where or what i am doing wrong.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  $(function() {
  
      //When submit button clicked
      $('#submit').click(function(){
  
          //Getting data from input fields
          var sentby_val = $('#sent_by').val();
          var message_val = $('#message').val();
  
          $.post('comment.php', { username: sentby_val, message: message_val }, function(return_data){
  
              //Response from script when comment inserted to database
              alert(return_data);
  
              //Clean fields
              $('#sent_by').val('&lt;?php print $_SESSION['email']?&gt;');
              $('#message').val('');
  
          });
  
      });
  });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>here is the html form</p>
  
  <pre><code>&lt;form  action='comment.php' method='post' style="width: 422px"&gt;
      &lt;input type='hidden' id="sent_by" name='sent_by' value="&lt;?php print $_SESSION['email']?&gt;"/&gt;
      &lt;input type='hidden' id="hidden_id"  name='hidden_id' value='&lt;?php print $picid;?&gt;'/&gt;
      &lt;textarea name='message' id="message" value="make your comment" style="width: 450px; height: 70px"&gt;make your comment&lt;/textarea&gt;&lt;br/&gt;
      &lt;input type='submit' name='sub'  value='comment' id="submit" style="border-style:none; float:right;" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>here is the comment.php // which shouldnt really be the problem</p>
  
  <pre><code>&lt;?
  $name = $_POST['sent_by'];
  $picid= $_POST['hidden_id'];
  $message = $_POST['message'];
  $sub = $_POST['sub'];
  
  if ($sub){if($name&amp;&amp;$message&amp;&amp;$picid)
  {
      $insert = mysql_query("INSERT INTO comment (name,message,picid) VALUES ('$name','$message','$picid')" );
  }
  else
  { 
      echo "Please enter a comment"; 
  }
  
  header("location:../profile.php?pic=$id");
  ?&gt;
  </code></pre>
  
  <p>please help what am i missing or not seeing</p>