Where should I put this file? - 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: Where should I put this file? (/showthread.php?tid=58576) |
Where should I put this file? - El Forum - 06-26-2013 [eluser]whygod[/eluser] Hi guys, In my view file, I have this jQuery codes, Code: $.get('getprogress.php', { uid: id, t: time }, function (data) { So where should I put getprogress.php in what folder? I hope someone will help me. Thanks in advance. Where should I put this file? - El Forum - 06-26-2013 [eluser]Pert[/eluser] Assuming getprogress.php is a controller, it goes to application/controllers/ folder, but your URL will be just getprogress without .php Where should I put this file? - El Forum - 06-26-2013 [eluser]whygod[/eluser] @Pert It's not a controller, It's just an ordinary PHP. And below are the codes of it. Code: <?php So where should I put an ordinary PHP codes? Where should I put this file? - El Forum - 06-26-2013 [eluser]whygod[/eluser] Okay lets assume I'll put those codes in the controller as a method. Is this the right jQuery codes to call the controller method from a view file? [code] $.get("<?php echo base_url('controller_name/getprogress.php') ?>", { uid: id, t: time }, function (data) { //more codes here... } [code/] Hope someone will give shed. Thanks in advance. Where should I put this file? - El Forum - 06-26-2013 [eluser]Pert[/eluser] If you must use just PHP you can put it anywhere you want, project root next to index.php or you can create your own subfolder. I would suggest you try to convert it to a controller if at all feasible, it will give you all the nice CodeIgniter features. As far as I can see this file doesn't really do that much so I can see the logic in not asking it to load CodeIgniter etc. Are you using URL rewrite? Where should I put this file? - El Forum - 06-26-2013 [eluser]boony[/eluser] Woof woof, Just put the code in a method in your controller and then pass it to the $.get('controller/getprogress')... no need to echo the base_url and drop the .php bit.. Boony |