Sahil
Sahil

Reputation: 3358

Can there be a response mismatch in AJAX call while getting the response?

I am having an application in which multiple users send queries via AJAX calls and get the response from other server. Now is it possible that if a User A sends request for getting ITEM 1 and at the same moment User B sends a request for getting ITEM 2, User A gets ITEM 2 and User B gets ITEM 1? (Both the users have logged and have separate sessions.) If it is possible then what I can do to stop it?

These requests are sent over to another server which is an API and the requests are stateless in nature. So, the API server does not store any thing and just sends the response for the request received. Can any one help or share a link for reference?

This is the last step I am stuck at in terms of user request-response safety before my application hits production environment.

Upvotes: 2

Views: 146

Answers (1)

Mathew Thompson
Mathew Thompson

Reputation: 56429

As long as the data retrieval code itself is thread safe (and there's no race conditions), then there should never be a mismatch in responses. It's not down to the mechanism of the AJAX call itself, it's more to do with the structure of the server code that's actually being executed.

Upvotes: 2

Related Questions