Ajax async true gets timeout issues

I am using django, nodejs, ajax request.

In Django I am using requests library for sending the REST request to Node.js

I am getting timeout issues and some times web page got broken when using async true in ajax request.

I had given simple example as follows

The concept is I have variable called arr = ["INDIA", "USA","UK","CANADA"]

AJAX —–Request—–> DJANGO ——-Request——-> NODEJS
(Giving each country information)

AJAX <——–Response——- DJANGO <——–Response——- NODEJS

   $(function() {
      $.each(arr, function( key, value ) {
            type: "POST",
            url: "/country/",
            dataType : 'html',
            cache: false,
            timeout: 10000000,            
            async: true,
          error: function(jqXHR, textStatus, errorThrown) { 
              console.log("ERROR: " + textStatus);


INDIA is incredible
USA is happy country
ERROR: timeout
ERROR: timeout


INDIA is incredible
USA is happy country
UK is cool contry
CANANDA is secure country

Source: ajax

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.