Is there a way not to wait for $.ajax
to complete?
#4947
Replies: 12 comments 5 replies
-
There's nothing in jQuery that makes it impossible to run multiple AJAX requests in parallel. If you run too many of them at the same time, browser limits may keep some of them waiting, though. jQuery cannot do anything about these issues. If you still can't make sense out of it, I'd advise you to post a more complete example on Stack Overflow to get some hints. |
Beta Was this translation helpful? Give feedback.
-
The browser, I think, queues up the |
Beta Was this translation helpful? Give feedback.
-
That's not true, there's no queuing like that. Responses may arrive at different moments and in a random order and the callbacks will be invoked in that order as well. |
Beta Was this translation helpful? Give feedback.
-
hello I would like to clarify if older versions of jQuery are also like this? We use jQuery-3.3.1. It really does function that way. I think this can be tried out, try running a long running process on a page, then try to make another request. The second request won't run until the first one finishes |
Beta Was this translation helpful? Give feedback.
-
Yes, older versions also behave like that. With HTTP/1.1 browsers often limit themselves to 4 parallel connections. If you already have 3 long ones running and you trigger 2 additional |
Beta Was this translation helpful? Give feedback.
-
Is there an explanation why it seems to be queuing up the callbacks? We have a long running process and subsequent requests only run once that long running process finishes |
Beta Was this translation helpful? Give feedback.
-
I cannot reply to that without diving deeper into your app which is beyond the scope of a bug tracker. As I suggested above, try other venues like Stack Overflow. |
Beta Was this translation helpful? Give feedback.
-
i would like to ask if there is a way for $.ajax to not wait for the callback of |
Beta Was this translation helpful? Give feedback.
-
I'm sorry but I don't understand the question. |
Beta Was this translation helpful? Give feedback.
-
i would like to clarify. Is there a way to run |
Beta Was this translation helpful? Give feedback.
-
If you don't attach any handlers to your |
Beta Was this translation helpful? Give feedback.
-
Yes
--
Michał Gołębiowski-Owczarek
|
Beta Was this translation helpful? Give feedback.
-
Hello,
It seems that if multiple
$.ajax
requests are running,subsequent requests will not run unless the previous requests finish running.
Is there a way to run
$.ajax
without it having to wait for it to finish, similarto fire-and-forget tasks? In essence we would like to make it run similar to a
Thread.
I think the behavior can be done when doing
fetch
requests but notawait
ing.Is there a way to do this in jQuery?
Thank You
Beta Was this translation helpful? Give feedback.
All reactions