This is a migrated thread and some comments may be shown as answers.

Problem with 2 ajax calls at once

1 Answer 63 Views
jQuery Mobile
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Silvi
Top achievements
Rank 1
Silvi asked on 13 Mar 2014, 01:17 PM
I have 2 parallel ajax calls to the server. The requests are independent from each other. The problem is that the second request is waiting for the first request's response. Is it possible to get the second request's response immediately, without waiting the first request's response.

1 Answer, 1 is accepted

Sort by
0
Pavel Kolev
Telerik team
answered on 14 Mar 2014, 07:38 AM
Hi Silvi,

jQuery $.when() is exactly what you need:

$.when( $.ajax("/req1"), $.ajax("/req2")).then(function(resp1, resp2){
    // plot graph using data from resp1, resp2
});


Regards,
Pavel Kolev
Telerik
 
Icenium is now Telerik AppBuilder, and is part of the Telerik Platform. Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!
Tags
jQuery Mobile
Asked by
Silvi
Top achievements
Rank 1
Answers by
Pavel Kolev
Telerik team
Share this question
or