title: $.ajax doesn't trigger success
body: <p>Somehow this api call only triggers success when I leave an alert at the page, any ideas?</p>
  <pre class="lang-html prettyprint-override"><code>&lt;button class=&quot;login100-form-btn&quot; onclick=&quot;CheckUser();&quot;&gt;Entrar&lt;/button&gt;
  </code></pre>
  <pre class="lang-js prettyprint-override"><code>function CheckUser() {
      const result = Auth();
  
      alert();
  }
  </code></pre>
  <pre><code>function Auth() {
      var data = { &quot;Login&quot;: $(&quot;#txtLogin&quot;).val(), &quot;Password&quot;: $(&quot;#txtPassword&quot;).val() }
  
      $.ajax({
          type: &quot;POST&quot;,
          url: 'http://localhost/myAPI/auth/UserAuthenticated',
          contentType: &quot;application/json&quot;,
          data: JSON.stringify(data),
          success: function (response) {
              console.error(response);
              if (response === &quot;200&quot;) {
                  window.location.href = &quot;http://localhost/mySite/Home&quot;;
              }
          }        
      });
  }
  </code></pre>