Controller variable lost after change - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Controller variable lost after change (/showthread.php?tid=60062) |
Controller variable lost after change - El Forum - 01-08-2014 [eluser]Keylocker[/eluser] I have a simple jquery progress bar that should get a variable from Codeigniter controller and print it on screen. The problem is that when a function changes that variable, the result is lost and so the progress bar shows 0. Here's my code: Code: class Emails extends CI_Controller { In jquery Code: function getProgress(){ The progress variable always comes back empty (NaN). Any suggestions? Thanks a lot guys. Controller variable lost after change - El Forum - 01-08-2014 [eluser]InsiteFX[/eluser] Code: public static $p; Controller variable lost after change - El Forum - 01-08-2014 [eluser]Keylocker[/eluser] I'm sorry mate, didn't work. When I print the output from AJAX Code: $.get('<?=site_url("/emails/progress"); ?>', function(data) { I get this Code: <div solid #990000;padding-left:20px;margin:0 0 10px 0;"> The line 659 of course is the line that outputs the data in the progress() function Controller variable lost after change - El Forum - 01-08-2014 [eluser]Keylocker[/eluser] Solved using session variable. Here's the correct code Code: public function __construct() Controller variable lost after change - El Forum - 01-08-2014 [eluser]InsiteFX[/eluser] PHP Static Variables Controller variable lost after change - El Forum - 01-08-2014 [eluser]Keylocker[/eluser] [quote author="InsiteFX" date="1389223104"]PHP Static Variables[/quote] The function didn't set nor return the variable, actually don't know why. My workaround might not be beautiful, I admit, but it got the job done Client happy = everybody happy Thanks anyway for your hints mate |