By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,761 Members | 1,129 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,761 IT Pros & Developers. It's quick & easy.

single thread JavaScript and callbacks from XHR

P: n/a
If JavaScript is single threaded, what is happening if I have two ajax
calls executed around the same time. and they come back and hit two
different callbacks. Would the callback functions execute at the same
time together. Would one take precedence over the other?

Feb 16 '07 #1
Share this Question
Share on Google+
3 Replies

P: n/a
On Feb 16, 5:18 pm, "NeoAlchemy" <NeoAlch...@gmail.comwrote:
If JavaScript is single threaded, what is happening if I have
two ajax calls executed around the same time. and they come
back and hit two different callbacks. Would the callback
functions execute at the same time together. Would one take
precedence over the other?
(Assuming asynchronous request, which are the type that should be
used)The first response to get to the point of executing its -
onreadystatechange - handler would call its function first, and the
other at some subsequent point, after the first had finished.

Richard.

Feb 16 '07 #2

P: n/a
On Feb 16, 11:38 am, "Richard Cornford" <Rich...@litotes.demon.co.uk>
wrote:
On Feb 16, 5:18 pm, "NeoAlchemy" <NeoAlch...@gmail.comwrote:
If JavaScript is single threaded, what is happening if I have
two ajax calls executed around the same time. and they come
back and hit two different callbacks. Would the callback
functions execute at the same time together. Would one take
precedence over the other?

(Assuming asynchronous request, which are the type that should be
used)The first response to get to the point of executing its -
onreadystatechange - handler would call its function first, and the
other at some subsequent point, after the first had finished.

Richard.
Thank you that was what I was looking for.

Feb 17 '07 #3

P: n/a
On Feb 16, 11:38 am, "Richard Cornford" <Rich...@litotes.demon.co.uk>
wrote:
On Feb 16, 5:18 pm, "NeoAlchemy" <NeoAlch...@gmail.comwrote:
If JavaScript is single threaded, what is happening if I have
two ajax calls executed around the same time. and they come
back and hit two different callbacks. Would the callback
functions execute at the same time together. Would one take
precedence over the other?

(Assuming asynchronous request, which are the type that should be
used)The first response to get to the point of executing its -
onreadystatechange - handler would call its function first, and the
other at some subsequent point, after the first had finished.

Richard.
Thank you that was what I was looking for.

Feb 17 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.