title: Ajax Form Submit - When click change html element text
body: <p>So I'm trying to create a message system. When I click on the Message to open my template opens in the same page the message content. I'm trying to make like: "See" Button->ajax->replace with jquery .text("Blah Blah"). the problem is that when I try tod</p>
  
  <p>HTML Code:</p>
  
  <pre><code>&lt;form method="POST"&gt;
                  &lt;button type="button" class="btn btn-small btn-success" name="msg_preview_id" value="'.$inbox_row['id'].'"&gt;New&lt;/button&gt;
              &lt;/form&gt;
  </code></pre>
  
  <p>Jquery Ajax Form:</p>
  
  <pre><code>$(document).ready(function(){
  $('button[name=msg_preview_id]').click(function(event) {
  
                  var formData = {'msg_preview_id' : $('button[name=msg_preview_id]').val()};                
  
  
          $.ajax({
              type        : 'POST', // define the type of HTTP verb we want to use (POST for our form)
              url         : '../../class/messages/inbox_preview.php', // the url where we want to POST
              data        : formData, // our data object
              dataType    : 'json' // what type of data do we expect back from the server                        
          })
  
              .done(function(data) {                            
  
                  console.log(data);                                                        
  
                                  //Email Stuff
                                  $('h1[id=emailheading]').text(""+data.info.subject+"");
                                  $('a[id=emailfrom]').text(""+data.info.from+"");
                                  $('span[id=emaildate]').text(""+data.info.rcvdat+"");
                                  $('p[id=emailtext]').text(""+data.info.text+"");
  
                                  //Ceninhas
                                  $('#inbox-wrapper').addClass('animated fadeOut');
                  $('#inbox-wrapper').hide();                 
                  $('#preview-email-wrapper').addClass('animated fadeIn ');           
                  $('#preview-email-wrapper').show();         
                  //$('.page-title').show();  
                  //Load email details
                  $('#inbox-wrapper').removeClass('animated fadeOut');            
                  $('#inbox-wrapper').removeClass('animated fadeIn');
  
              });                   
  
                          event.preventDefault();         
  });
  });
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>&lt;?php
  
  include ('../../inc/config.inc.php');
  
  $data = array();
  $info = array();
  
  $Msg_Preview_ID = $_POST['msg_preview_id'];
  
  $MsgSQL = mysqli_query($Connection, "SELECT * FROM messages_inbox WHERE id='$Msg_Preview_ID'");
  $Msg = mysqli_fetch_assoc($MsgSQL);
  
  $bzQuery = mysqli_query($Connection, "SELECT * FROM members_profile WHERE id='".$Msg['from']."'");
  $bzFetch = mysqli_fetch_assoc($bzQuery);
  
  $info['from'] = $bzFetch['fname']." ".$bzFetch['lname'];
  $info['subject'] = $Msg['subject'];
  $info['text'] = $Msg['text'];
  $info['rcvdat'] = $Msg['rcvdat'];
  
  $data['info']  = $info;
  
  echo json_encode($data);
  </code></pre>