Reputation: 2457
I'm wondering how should I go on and implement an updating progress bar. Basically the server should periodically send a confirmation on what is the current progress to the user.
I know how to do an Ajax call with Django and jQuery, which is similar to figure 1.
On my webpage, what happens is that a "processing" text box appears in the middle of the data the user wants to view.
However, I want to make it so that I could send periodic update to the user. For example, instead of "processing", I want to print out it's currently processing X, Y, and then finally Z, shown in figure 2.
If I use my method in figure 1, if I send anything back to the server, it will end the ajax request and jump to "success" in jQuery. Is there a way to constantly send data to the user without ending my ajax call?
Can anyone point me to the right direction?
Upvotes: 0
Views: 1240
Reputation: 27012
Have the request that generates the dictionary write its progress to a database, and have a second ajax request polling the server to check the progress and report to the user.
Upvotes: 1