single thread JavaScript and callbacks from XHR

N

NeoAlchemy

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?
 
R

Richard Cornford

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.
 
N

NeoAlchemy

(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.
 
N

NeoAlchemy

(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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top