title: Ajax success function
body: <p>I am using an Ajax post to submit form data to the server, be validated and then return a message based on whether or not the data was valid and could be stored. My success function in my ajax post doesn't run though. Here is the ajax post and the displaying of the success message:</p>
  
  <pre><code>jQuery.ajax({           
      type:"post",
      dataType:"json",
      url: myAjax.ajaxurl,
      data: {action: 'submit_data', info: info},
      success: function(data) {
          successmessage = 'Data was succesfully captured';
      }
  });
  
  $("label#successmessage").text(successmessage);
  $(":input").val('');
  return false;
  </code></pre>
  
  <p>No message gets displayed on the label though. I tried setting the successmessage variable to a set value in the code and it displayed fine, so there must be something wrong with my success function, I just can't see what? I also tried setting the error callback like this:</p>
  
  <pre><code>error: function(data) {             
      successmessage = 'Error';
  },
  </code></pre>
  
  <p>But still no message gets displayed.</p>