title: How to disable beforeunload action when user is submitting a form?
body: <p>I have this little piece of code:</p>
  
  <pre><code>&lt;script&gt;
  $(window).bind('beforeunload', function() {
    $.ajax({
      async: false,
      type: 'POST',
      url: '/something'
      });
    });
  &lt;/script&gt;
  </code></pre>
  
  <p>I wonder, how could I disable this request when user hits the submit button.</p>
  
  <p>Basically something like here, on SO. When your asking a question and decide to close the page, you get a warning window, but that doesn't happen when you're submitting the form.</p>