title: Jquery Ajax script request still loads even after aborting the call ( pending status)
body: <p>I tried to load a script via ajax call with a timeout, if the calls fail after timeout then I abort the call, but when I inspected the network tab I can see the status of the js is still pending and also the pages loader still loads.</p>
  
  <p><a href="https://i.stack.imgur.com/4aR54.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4aR54.png" alt="enter image description here"></a></p>
  
  <p>The script file I was trying to load is google map API from China, if the request fails I load the Chinese version of API and it works fine, but it takes more than one minute to stop the page loading and to show the below message.</p>
  
  <p>jquery.min.js:2 GET <a href="https://maps.googleapis.com/maps/api/js?key=" rel="nofollow noreferrer">https://maps.googleapis.com/maps/api/js?key=</a>"--mykey---"&amp;libraries=places&amp;_=1553093568934 net::ERR_TIMED_OUT </p>
  
  <p>My code for loading and aborting is below</p>
  
  <pre><code>var xhr = $.ajax({
      url: "https://maps.googleapis.com/maps/api/js?key=keyyy&amp;libraries=places",
      dataType: "script",
      timeout: 5000
    }).done(function() {
      //do stuff
      console.log("loaded");
    })
    .fail(function() {
      //do stuff
      console.log("fail");
      xhr.abort();
      $.ajax({
        url: "https://maps.google.cn/maps/api/js?key=keyy&amp;libraries=places",
        dataType: "script",
        timeout: 5000
      }).done(function() {
        //do stuff
        console.log("loaded");
  
      })
  
    });
  </code></pre>
  
  <p>I also tried this</p>
  
  <pre><code>        var xhr = $.ajax({
              url: "https://maps.googleapis.com/maps/api/js?key=key&amp;libraries=places",
              dataType: "script",
              timeout: 5000,
              success:function(){
  
              },
              error:function(a,b,c){
                  //do stuff
                  console.log("fail");
                  console.log(a,b,c);
                  console.log(xhr.state());
                  xhr.abort();
                  console.log(xhr.state());
                  $.ajax({
                      url: "https://maps.google.cn/maps/api/js?key=key&amp;libraries=places",
                      dataType: "script",
                      timeout: 5000,
                      success:function(){
                          console.log("loaded chinese")
                      },
                      error:function(a,b,c){
  
                      }
                  })
              }
          })
  </code></pre>