javascript - 2 simultaneously ajax request, respond asynchronously -
this question has answer here:
- php - flushing while loop data ajax 3 answers
- php echo result while iterating through loop 2 answers
this question different because check solution , didn't answer. pass on , can see end of question, how.
first make ajax request (request 1) php script , script in it's loop calculate , store in file when each iteration finished.
simultaneously request 1
there ajax request (request 2) php script read modified file request 1
.
request 2
executing each 0.5 second , read file content.
what expect request 2
respond file content when request 1
in progress. of request 2
requests send each 0.5 second pending, , respond when request 1
finished , send it's data. somehow can say, these tow request send simultaneously request 2
respond when request 1
finished , complete.
could tell me fault please?
thanks in advance
-------------------- edit --------------------
i using yii framework , problem occurred because of existence of default filter
action in controller php scripts exist
luck ;)
i'm not sure can want using ajax. being said possible using server-sent events (a.k.a. eventsource). api allows data sent javascript server on period of time (in case short one). you'll need modify both php script , js bit, it's not hard connection , running.
Comments
Post a Comment