php - Are ajax requests guaranteed to hit the server in order? -


from the docs:

the first letter in ajax stands "asynchronous," meaning operation occurs in parallel , order of completion not guaranteed.

i interpret mean then/done/always/fail callbacks not guaranteed fire in order requests went out. makes sense if you're calling different api endpoints , take longer others.

what want know if you're making ajax requests same api endpoint, guaranteed reach server in order?

i've written code autosaves draft type, , want know if i'm guaranteed saving latest copy of draft, or if it's possible older ajax request come in after newer 1 , php code cause newer draft overwritten older one. doesn't matter in order requests return; order they're received matters.

i can conceive of way fix this, want know if it's necessary.

requests can arrive in order network(s) involved decide deliver packets in.

e.g.

request #1 @ timepoint 0.000 takes route a
request #2 @ timepoint 0.123 takes route b

but backhoe cuts fibre cable handling route a, causing network reroute through route c, uses rfc 1149 carrier, causing 12 hour delay in arrival. @ server, end getting

request #2 arrives @ timepoint 0.173, taking nice "slow" 50ms route
request #1 arrives @ timepoint 12:00:00:0.50, having taken longer route.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -