I want to send another ajax request when one request is in process to get the status of first request.
If I call both the request the second request gets blocked till the completion of the first request.
Can anyone suggest a method so that second request gets processed in between when the first request is processing.

Client-side should have no problem achieving this. Just make sure that you are not using any global variables that are common to both processes. (Even better, use no globals at all).

Server-side is more of a concern. If the first process is CPU intensive, then you are maybe expecting a lot of the server also to respond to further requests. If the first process is I/O intensive, then the expectation is more reasonable.

If "the server" is actually a server farm (for load sharing), then it is entirely possible (even likely) that progress requests would be handled by a different server from that handling the original. If so then, mmmm, would it have knowledge of the original server's progress? I can't give you any better than a "possible-maybe" on that.

You might consider an alternative approach involving just one request. I've never needed to do this and I guess it's moderately involved, but I'm pretty certain that you can get the server to issue intermediate responses with custom HTTP headers (500 series?). Client-side you should be able to handle everything in the same response handler (trivial in regular javascript but tricky in jquery).

I think there's more mileage in this approach than in making additional requests. Maybe someone with more experience in this area can provide more detail. Or try a Google search.

Airshow

Thank you for your reply, yes I am using common variable in both requests. What i am doing is this in first request I am syncing my product prices on global database prices which takes time as there are 1000's of products not in second request what I am trying to show is this that how many product prices are synced and how many still pending so that user must by in sync with the process and get to know the status periodically.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.