title: Unable to change button text after successful form send through ajax request to the server?
body: <p>I am unable to show modified button text through ajax handlers and I am able to submit form data but can't show the success message to user in front end.</p>
  <pre><code>exports.postEntriesCollection = (req, res) =&gt; {
      Campaign.findOne({ slug:req.params.slug }, function(err, campaign) {
          const photo = new PhotoEntries({
              Email:req.body.email,
              Name:req.body.name,
              Description:req.body.description,
              Phonenumber:req.body.Phone, 
              CampaignId:campaign._id,
      });
      photo.save().then(photo =&gt; {
          req.flash('success', { msg: 'Uploaded successfully' });
          res.status(200).json({ 'status': 200, msg: 'Completed' })  
      });
   }
  **Ajax request form is :**
  </code></pre>
  <p>form is submitted but the button text is not working?Is there any additionally required to get response from server and apply in front end? I want to implement to show success or some message to user after form submission. How can achieve that?
  This is my ajax code to send form which has ID with <code>contactMesubmit</code> and submitting form but not able to show success message which is sending from backend.</p>
  <pre><code>$(document).ready(function () {
      $(&quot;#contactMesubmit&quot;).click(function (event) {
          event.preventDefault();
          var form = $('#fileUploadForm')[0];
          var data = new FormData(form);
         $.ajax({
              type: &quot;POST&quot;,
              enctype: 'multipart/form-data',
              url: &quot;/photoapp/&lt;%=slug%&gt; &quot;,
              data: data,
              processData: false, 
              contentType: false,
              success: function (msg) {
                  if( msg == 'Completed' ){
                      $(&quot;#contactMesubmit&quot;).prop(&quot;disabled&quot;, false);
                      $(&quot;button #contactMesubmit&quot;).html(&quot;success&quot;)
                  }
                  else {
                      $(&quot;#contactMesubmit&quot;).prop(&quot;disabled&quot;, false);
                  }
              }      
          });  
      });  
  });
  </code></pre>
  <p>I want when form submitted the response will send to front as msg:Completed and i am checking the msg in front end with if condition and alter the button text accordingly.?</p>