title: Success message not displaying using jQuery ajax
body: <p>So I have verified that my <code>contact.php</code> (phpmailer file) is working. However at the end, given a successful response, the <code>contact.php</code> says <code>echo: 'done'</code></p>
  
  <pre><code>if(!$mail1-&gt;send()) {
      echo 'error';
      //echo 'Mailer Error: ' . $mail-&gt;ErrorInfo;
      return false;
  } else {
      echo 'done';
      return true;
  }
  </code></pre>
  
  <p>At that point (I'm guessing since I paid a developer to create the form for me, but haven't tried to test with my own host til recently. This is the code he supplied.</p>
  
  <pre><code>/************
   AJAX Method
  *************/
  function submitForm()
      {
          //1. user clicked on submit/send button after filling form
          $('#contactform').on('submit',function(e){
              //2. this line will prevent the window's reload!
              e.preventDefault();
          });//end form submit
  
          //3. handilg the success div
          $('#success_message').show();
          $('#success_message h2').text('Processing, wait please...');
          $('#submit_cf').attr('disabled','disabled');
  
          //4. the actual ajx process starting from here
          $formData = $('#contactform').serialize();
  
          $.ajax({
              url : "contact.php",
              type: "POST",
              data : $formData,
              success: function(data) {
                  //data - response from server
                  //console.log(data);
                  if(data == 'done'){
                      $('#success_message h2').text('Mail Sent Successfully!');
                  }else{
                      $('#success_message h2').text('There is an error, try again later!');
                      // $('#submit_cf').attr('disabled','disabled');
                  }
              }//end success
          });//end ajax
      }//end submitForm() function
  })(jQuery, window, document);
  &lt;/script&gt;
  </code></pre>
  
  <p>I'm assuming that <code>echo: 'data'</code>, <code>return: true</code> shoud send the word <code>data</code> back to the ajax form where the:</p>
  
  <pre><code>if(data == 'done'){
      $('#success_message h2').text('Mail Sent Successfully!');
  </code></pre>
  
  <p>would take over and populate the <code>div#success_message h2</code> html with <code>Mail Sent Successfully</code>.</p>
  
  <p>Only instead, the ajax doesn't work at all. Instead a new page loads with just the word "done" on it (which is what I expect happens when you use echo:'done'). </p>
  
  <p>I don't know how to make ajax take in 'done' and then populate the same page with the success message.</p>
  
  <p>I loaded jquery into the header, as it is used for several other scripts. The ajax script is in the html rather than an external script.</p>
  
  <p>Please tell there is a simple fix, or do I need to start over with Swift?</p>