title: jQuery: ajax call not executed on form submit event unless I have a alert call after it?
body: <p>I'm doing some modifications to an existing form on web application. I can't have access to the form's code, but I can add scripts to the page, so I'm doing some customizations with the help of jQuery.</p>
  
  <p>So, right now I have something like this:</p>
  
  <pre><code>jQuery( "#new_user" ).submit(function( event ) {
  
      event.preventDefault();
  
  var fullname = jQuery("#user_name").val();
  var email = jQuery("#email_primary").val();
  var company = jQuery("#contact_customer").val();
  
  jQuery.ajax({
          async: false,
          dataType: 'jsonp',
          url:"https://server.com/script.php",
          data: {"fullname": fullname, "email": email, "company": company},
          success: function(response){
          alert("json says " +response.res);
          }
  });
      alert("hello");
  });
  </code></pre>
  
  <p>Now, this works fine. I'm basically intercepting the form submission.</p>
  
  <p>Problem is, <strong>the ajax call is only executed if I keep the alert() call in there</strong>, something obviously I do not want, it's just for debug. If I remove the alert() call, the form will submit but the ajax call will not work as it should. I have access to the web server that is supposed to receive the JSONP request, and it doesn't even get there.</p>
  
  <p>The second alert actually never gets executed, but actually I don't need anything there, I just need to receive the GET on the webserver.</p>
  
  <p>I have tried to add async:false to ajax() options, but no luck.</p>
  
  <p>I'm a bit puzzled, and researched/experimented about it quite a bit. any tip appreciated, thanks in advance.</p>