0

I want to make multiple ajax call on same Django view so that I get all the response from those calls at the same time. For example: If this is my ajax call

$(document).ready(function(){
  $(document).on('click', '.btn', function(event){
    event.preventDefault();
    $.ajax({
      type:'GET',
      url:'',
      dataType:'json',
    });
   });
});

And the ajax call request this view

def ajax_call(request):
    time.sleep(5)
    return JsonResponse()

Now what I want is, if I make three multiple ajax call parallely on same view 'ajax_call' (in above example) I should get all the 3 responses in 5 seconds instead of 5*3=15 seconds that means the ajax call should work parallelly.

I tried the above format but I get the response back in (5*3=)15 seconds . So what change should I make in above jquery ajax call ?

Roman K.C.
  • 49
  • 2
  • 7

0 Answers0