CodeIgniter Forums
Ajax & CI3 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Ajax & CI3 (/showthread.php?tid=61464)



Ajax & CI3 - sackbut - 04-17-2015

I downloaded this https://github.com/bcit-ci/CodeIgniter/wiki/Ajax-Framework-For-CodeIgniter to try out Ajax in CI3 RC3

When I try and run the demo I get :

"Notice: Use of undefined constant VIEWPATH - assumed 'VIEWPATH' in C:\web\codeigniter\system\core\Exceptions.php on line 242"

from PHP

Anyone any ideas ? Or can you recommend an Ajax add-on that actually works ?


RE: Ajax & CI3 - mwhitney - 04-17-2015

Every download I can find for that framework is almost 2 years old, so I'm not sure how much work it would take to get it working with CI 3. The VIEWPATH is defined in CI's index.php file, which that framework has replaced with something that's definitely not up to date.

As for ideas, I really don't have any. It's not any more or less difficult to use AJAX with CI than with any other framework, and most of the heavy lifting when dealing with AJAX is on the JavaScript side of things.


RE: Ajax & CI3 - bitwizard - 04-17-2015

I use and would recommend JQuery for Ajax integration with CI.
It is fast, well documented, and has tons of plugins.
Since the nature of AJAX is client-side, (the J in Ajax is "Javascript"), you are better off dealing with it in Javascript on the client side than you would be trying to force it into server-side logic (PHP).


(04-17-2015, 02:32 AM)sackbut Wrote: I downloaded this https://github.com/bcit-ci/CodeIgniter/wiki/Ajax-Framework-For-CodeIgniter to try out Ajax in CI3 RC3

When I try and run the demo I get :

"Notice: Use of undefined constant VIEWPATH - assumed 'VIEWPATH' in C:\web\codeigniter\system\core\Exceptions.php on line 242"

from PHP

Anyone any ideas ? Or can you recommend an Ajax add-on that actually works ?



RE: Ajax & CI3 - sackbut - 04-18-2015

(04-17-2015, 02:20 PM)mwhitney Wrote: Every download I can find for that framework is almost 2 years old, so I'm not sure how much work it would take to get it working with CI 3. The VIEWPATH is defined in CI's index.php file, which that framework has replaced with something that's definitely not up to date.

As for ideas, I really don't have any. It's not any more or less difficult to use AJAX with CI than with any other framework, and most of the heavy lifting when dealing with AJAX is on the JavaScript side of things.

OK - thanks for that. I'll abandon it. I'll do what I should have done first - recognise that Ajax is mainly a client side technology and just concentrate on the Javascript, not the PHP framework

tnx agn
KT


RE: Ajax & CI3 - sackbut - 04-18-2015

(04-17-2015, 05:18 PM)bitwizard Wrote: I use and would recommend JQuery for Ajax integration with CI.
It is fast, well documented, and has tons of plugins.
Since the nature of AJAX is client-side, (the J in Ajax is "Javascript"), you are better off dealing with it in Javascript on the client side than you would be trying to force it into server-side logic (PHP).



(04-17-2015, 02:32 AM)sackbut Wrote: I downloaded this https://github.com/bcit-ci/CodeIgniter/wiki/Ajax-Framework-For-CodeIgniter to try out Ajax in CI3 RC3

When I try and run the demo I get :

"Notice: Use of undefined constant VIEWPATH - assumed 'VIEWPATH' in C:\web\codeigniter\system\core\Exceptions.php on line 242"

from PHP

Anyone any ideas ? Or can you recommend an Ajax add-on that actually works ?

Sounds like that thing I downloaded does not work with CI3 si I've dumped it.

You're right, of course - it's a client side technology, so forget PHP frameworks ! I'll take you advice and use the jQuery stuff. I have written some very simple AJAX routines - for updating form fields without having to POST and stuff like that. So I'll see how jQuery handles that and move on from there.

My main concern is not to clutter up the view with all sorts of bits of script etc... but with an event driven thing like AJAX I can't see any way to avoid it.

rgds
KT


RE: Ajax & CI3 - mwhitney - 04-20-2015

(04-18-2015, 03:15 AM)sackbut Wrote: My main concern is not to clutter up the view with all sorts of bits of script etc... but with an event driven thing like AJAX I can't see any way to avoid it.

You should be able to put most of the script into .js files and load them into your views with script tags (or use an assets library to load them). More often than not, you'll be able to boil down most of your site into a handful of page types which need specific sets of scripts. At that point, you can usually load a set of scripts for the current page type and then add a couple of lines of script to configure the scripts for the current page, if needed.