CakePHP and jQuery

When I recently started working on some of my ideas of a web application, then CakePHP is the framework of my choice. I am working with it since last 3-4 years and have a good understanding of the features and architecture. Now, I planned to use as much AJAX as possible in this application, I need to find a good Javascript framework/library. JQuery is the best available JS framework at present, with everyone trying to use this in any possible way. JQuery is lightweight, fast, supports multiple browsers and quick to code.

But as of now CakePHP’s built-in AJAX features does not use JQuery, they are based on “prototype”. In the new version CakePHP, which is under development, they are planning to provide support for multiple JS libraries. But that is very less documented and not available for production ready sites.

So, I must put off using AJAX and Javascript helpers and have to custom code various JS functionality. Earlier I thought that it would take lot of time and I might need to manipulate few core files to integrate the JQuery and CakePHP. But when I started using JQuery and learned more about it – I found that they already have great features and plug-ins which would make them independent of the server side language or framework.

To submit a form using AJAX in CakePHP, I just needed to write 3 lines of JS code and include two plug-ins of JQuery – “livequery” and “form”. That is it!

I would have written more code, If i have used that default AJAX Helper which uses prototype. I have just started with JQuery and I am very impressed with it like most of you. I do not know when CakePHP will have support for it, but I am going to use it from today for all AJAX and Javascript requirements in CakePHP.

Leave a Reply

Your email address will not be published. Required fields are marked *