The new release of CakePHP (RC2) comes with a completely rewritten AjaxHelper::form() function (with the disadvantage that it breaks existing code). Let’s look how to use it:
$ajax->form(array('action' => '/controller/action'), 'post',
array('update' => 'mydiv'));
I think this code is self-explanatory (if not, please write a comment). What’s cool about this code is the fact that it will also work when you disable JavaScript. The form will submit the form data in both cases to /controller/action.
That means you have to distinguish in your action whether it is called via Ajax or not, and then you have at least to select the appropriate layout. You can do it in the following way (thanks to nate for this hint):
Continue Reading the Tutorial
Showing posts with label Applications. Show all posts
Showing posts with label Applications. Show all posts
How to make Username Avaialable or not checking Script using Ajax?
How to make Username Avaialable or not checking Script using Ajax?
The goal of this AJAX example is to allow a user who is registering for your site to see if the username they want to use is taken already or not, without having to submit a form and reload the page.
Read the complete tutorial
AJAX username availability checking
The goal of this AJAX example is to allow a user who is registering for your site to see if the username they want to use is taken already or not, without having to submit a form and reload the page.
Read the complete tutorial
AJAX username availability checking
Subscribe to:
Posts (Atom)