title: Asynchronous Ajax Logic
body: <pre><code>$("#container").on("change", "#control1", function() {
      if ($("#checkData").val()) {
          $.get("/Controller/CheckData/" + $("#control2").val(), function(data1) {
          if(!data1.Success) {
             alert("Unable to do POST.");           
             return;
          });
      };
      formData = $("#form").serialize();
      $.post("/Controller/PostData", formData, function(data2) {
          // Do something...
      });
  }
  </code></pre>
  
  <p>If checkData is false, the form should post. If checkData is true, the form should only post if the get returns true.</p>
  
  <p>This doesn't seem to work because the form gets posted while the alert dialog is still open. I think it may be due to the asynchronous nature of AJAX. Is this correct?</p>