8
I wrote a system in Web2py for a client, and he wants me to automate a procedure. I thought of using Ajax. The idea is the following:
I have a list of companies. Let’s say, 50. I want the screen to open with the list of companies and, at the top of them, have a "Start" button. When I click "Start", the page sends to the server an Ajax request asking to run a calculation for the first company. This is done because it is a heavy calculation, and leaving everything on a request would make Nginx return a timeout and the calculation would not go through.
How to update the status on the screen. Now comes my question.
After the calculation of the first company, the calculation of the second enterprise is automatically called. At the end of the second, it is called the calculation of the third, and so on, until the calculation of the other:
Empresa 1: Ok!
Empresa 2: Ok!
Empresa 3: Processando...
Empresa 4: Aguardando...
...
The idea is that I can also pass some parameters beyond the company code, as for example a date range.
How can I do this? Should I use pure Ajax or can I use a JS package for this?
I did not understand very well your doubt: these parameters to be passed come from where? (some input user, for example, set before he click "Start"? ) And is there any restriction regarding the solution, or is it just a matter of JS even? (It seems simple to do manually, if there is no framework in use capable of this, I do not justify introducing a new one just for this)
– mgibsonbr
It’s pure JS. Suppose I can pass the dates using
<input text>
s and reading the values using jQuery, for example. The challenge is to call the procedures sequentially.– Leonel Sanches da Silva