progress bar with ajax : problem with ci3 resolved :) |
Hello,
I use one controller, one library and one javascript file in order to show in a progressbar the progression of a making file. In my view, i'have a button and a dropdown list. I choose one item of this dropdown list and then push the button. A jquery action on this button send to my server a request to my controller. The controller launches a function of my library which making my excel file. During construction of my file, I update the progress of my file in the database (example : 5, 10, 15 ..., 80, 100 %). Every fives seconds, in my wiew, a javascript function launches a request to this same controller, calling an another method who read my progression in my database and return json_encode values (example: echo json_encode(array('value' => $my_progress)) ; ). The json values is written in my progressbar. I observe via firebug the progress of my request who is launched every 5 seconds. I never get back from the server except when the file is completely built (100%) . With version 2 of codeigniter , I use the same code and it works : every five seconds, the request is launched and i had my return (5 or 10 or 50 or 80 % etc.) and i can show the progress of the file, but with ci3 not. Can anyone help me? Example : My controller PHP Code: // function call by ajax request to make file PHP Code: public function do_action()
My guess is the ajax request creating the file is keeping the session lock until it finished and the ajax request for the progress bar is waiting for the session lock to be released. You need to call session_write_close(). Read this section in the user guide: http://www.codeigniter.com/userguide3/li...oncurrency
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/ (05-30-2015, 10:26 AM)includebeer Wrote: My guess is the ajax request creating the file is keeping the session lock until it finished and the ajax request for the progress bar is waiting for the session lock to be released. You need to call session_write_close(). Read this section in the user guide: http://www.codeigniter.com/userguide3/li...oncurrencyhello, Thanks you very much, that solved my problem. |
Welcome Guest, Not a member yet? Register Sign In |