Where should I put this file? |
[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.
[eluser]Pert[/eluser]
Assuming getprogress.php is a controller, it goes to application/controllers/ folder, but your URL will be just getprogress without .php
[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?
[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.
[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?
[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 |
Welcome Guest, Not a member yet? Register Sign In |