perl - Further question on segmenting AJAX responses -
This question is already related to one, see.
One way to apply Ajax to the segment responses, I created a code that does this:
Customer first calls the script that initiates the process on the server side , StartScript.cgi starts generating code data, and does so, it group responses into fragments, and writes them in indexed indexes (chunk1.txt chunk2.txt, etc.) into individual files. Start-up CCG immediately after starting this process, client side starts each other's AJAX request, sent together to produce output. Cgi, with parameters? Index = 0
The gathered CGI request sees, and then appears in 'Chuck'. $ Index '.txt' and then returns the data that the client outputs it to HTML, and then the second ajax request starts to gather the output. Cgi with the parameter? Index = 1, etc. It continues until all data of startScript.cgi is reported
if the collect can not find the output .cgi "piece $ index.txt", then this loop In: (<-) "$ directory / $ index.txt") {#nothing} open $ FH, " Note that startScript.cgi runs the code that can take a long time to complete, so point together startScript.cgi The old output is to be transmitted since it is producing new output. With this problem, the performance suffers, and in spite of the production produced a long time ago, production will take some time. I'm thinking that harddrive is being used slower than CPU functions that begin, so startup.cgi is to collect, then OUTUPTG is often being written on new volume, or the client is often gathering IUTput.cgi files, etc. is waiting to be collected. However other problems may occur. Any ideas or suggestions to fix this problem? Or if someone has a different view of this problem which would be great well. By the way, startScript.cgi can be called only once, it starts a big functioning system (such system with survival, exec, system, or backtix) that keeps moving Is, and can not be split well.
"|| Warning "file not found. Blah blah"; #read file and print, etc ...
Your collected output. Cgi should not be left in the loop when the file does not exist. Instead, return a status to your AJAX request that the file is not yet present and then wait for it (using setInterval or setTimeout) and try again after so many seconds.
This will be very easy on your server. For the user you can still show a loading graphic or something that tells them that the background is still happening in the background.
Comments
Post a Comment