Ajax and Ajax Frameworks

I have been a developer for nearly 20 years and a web developer for about 10 years. Over the years, I have considered creating a blog to share the things I have learned (and am learning) about web design and development, but I never seemed to have the time. When I began learning about web development using Ajax and Ajax Frameworks, I decided to take the time to create this blog.

My intention for this blog is to focus primarily on Ajax Frameworks, but since web development requires knowledge of many technologies, I will occasionally write about things such as CSS, Javascript, PHP, MySQL, Flash, etc.

Lately, I have been using JQuery as my primary Ajax tool. Although I have used other Ajax Frameworks in the past (Dojo Toolkit, Yahoo! User Interface Library, Scriptaculous/Prototype), JQuery has thus far been the easiest to learn. In my first few posts I will discuss some of the JQuery Plugins that I have created. Some of these include: a plugin for Google Maps (jquery.imGoogleMaps), Form validation and submission  (jquery.imValidateForm), Page Populater (jquery.imPagePopulate), and a plugin to create lists (jquery.imList).

While I am still learning about some of the other Ajax Frameworks, I hope that what I have learned will be helpful to others. Just remember, “When you can pull the pebbles from my hand…”

Share

CakePHP and Ajax: Missing View

Tuesday, October 27th, 2009

If you are using an Ajax Framework with CakePHP and receive the error message “Missing View”, then you need to add the following to your controller method:

function someMethod() {
     $this->autoRender = false;
}

Also, if you have debug turned on, you will receive a Parse error when JSON data is returned back. CakePHP set the debug level to 2 by default. You can turn it off in the app/config/core.php file by setting the debug level to 0. YOu probably don’t want to do this in the development environment. A better solution is to add the following to your controller method:

function someMethod() {
     $this->autoRender = false;
     if ( $this->RequestHandler->isAjax() ) {
          Configure::write ( 'debug', 0 );
     }
}

This let’s CakePHP know that it is an Ajax request. If you use this method, make sure that you add the RequestHandler Component to your controller.

class MyController extends AppController {
        var $components = array('RequestHandler');
}
Share

One Response to “CakePHP and Ajax: Missing View”

CommentLuv badge