title: Show user that the form was submitted successful or not
body: <p>I have a form which sends data to a CRM. If I create a simple HTML form and send the data to the server it will refresh my webpage and show the text:</p>
  
  <pre><code>{"success":false,"error":{"message":"&lt;whatever the error is&gt;"}}
  </code></pre>
  
  <p>or</p>
  
  <pre><code>{"success":true,"result":"ok"}
  </code></pre>
  
  <p>After styling the form and integrating animations and validations and stuff everything still works perfectly. Now the data is sent by using <a href="http://jquery.malsup.com/form/#getting-started" rel="nofollow">http://jquery.malsup.com/form/#getting-started</a>. The server receives it but the user has no idea whether it did or not.</p>
  
  <p>Using this jQuery form plugin or some other plugin you might want me to use(or even code) please help me display text inside a div whether the operation was successful or not, depending on the server's response.</p>
  
  <p>I have only tried to display the response using the examples provided here: <a href="http://jquery.malsup.com/form/#ajaxForm" rel="nofollow">http://jquery.malsup.com/form/#ajaxForm</a> but I have failed until now.</p>
  
  <p>Here I've put together a JSfiddle with some form fields and the jQuery form plugin I am using in order to send the data to the server: <a href="http://jsfiddle.net/n78p9/1/" rel="nofollow">http://jsfiddle.net/n78p9/1/</a>.</p>
  
  <p>I hope someone will be able to show me what I did wrong or show me another way of doing this.</p>
  
  <p>Thank you!</p>
  
  <p>EDIT @Arun: so it looks like this:</p>
  
  <pre><code>submitHandler: function(form) {
          $(form).ajaxSubmit({
              target: '.optional',
              resetForm: true,
              success: function(responseText){
                  var result = jQuery.parseJSON(responseText);
                  if(!result.success){
                      alert(result.error.message)
                 }
            },
            error: function(){
               alert('Thank you for your message! Our team will contact you in the shortest possible time.')
            }
          }); 
      }
  </code></pre>
  
  <p>I am definitely on the right way, but there is a problem: the error alert actually shows when the response is successful. I do not understand why. I have intercepted the POST request through a local proxy and re-sent it through the server and the server sent back this:</p>
  
  <pre><code>{"success":true,"result":"ok"}
  </code></pre>
  
  <p>But the script considered it an error. That is why I have inserted that text into the error:alert field:D.</p>
  
  <p>What might be the problem?</p>