title: Wordpress, doing AJAX request before admin submit a post
body: <p>I need to do some server-side checking, before admin may submit a post form:</p>
  
  <pre><code>$('body').on('submit', '#post', function(e) {
      if (e.originalEvent === undefined)
      {
          return true;
      }
      var thisForm = $(this);
      $.ajax('/check.php', $(this).serialize(), function(answer) {
          // if answer was ok...
          thisForm.submit();
      });
      return false;
  });
  </code></pre>
  
  <p>actualy it works good, but in case when my post is "draft", I cant put it "public". Nothing changes, I guess some other JavaScript is affraing in the background.</p>
  
  <p>BUT if I do a synchronous verion:</p>
  
  <pre><code>$('body').on('submit', '#post', function(e) {
      var error;
      $.ajax({type: 'POST', url: '/action.php', data: $(this).serialize(), async: false, success: function(answer) {
          // if answer was ok...
          error = true OR false;
      });
      return !error;
  });
  </code></pre>
  
  <p>it all works GOOD! But you all know, one doesnt made synchronous ajax calls...</p>