I have problem with your example:
it is working, but right afret changing content of that div page
starts to reload, and stays blank for ages.
How can i forbid this reload?
On Jan 23, 8:20 pm, "codecowboy" <[EMAIL PROTECTED]> wrote:
> -- controllers --
>
> The following controller contains the action that will render the view
> in which theajaxcall is made. There is no controller logic needed
> here although for real application there probably would be. Do not
> forget to include the $helpers array as shown.
> class AjaxCallersController extends AppController{
> ...
> $helpers = array('Ajax', 'Javascript');
> ...
>
> function testAjaxCall(){
> //does nothing
> }
>
> }
>
> -------------
> The following controller contains the action that will be called
> remotely using theajaxhelper. It is important to render with theajaxlayout.
> NOTE -- you will create theajaxlayout later
> class AjaxTestsController extends AppController{
> ...
> $helpers = array('Ajax', 'Javascript');
> ...
>
> function practice(){
> //does nothing
> $this->render('practice', 'ajax');
> }}
>
> -------------
>
> -- views --
>
> The following view file contains the code to make theajaxcall. When
> the link is clicked, the content inside of the div tag will be replaced
> with the following text "Theajaxcall worked"
> /views/ajax_callers/test_ajax_call.thtml
>
> <div id='ajax'>Everything inside this div tag will be replaced by the
> response from theajaxfunction</div>
> <?php echo($ajax->link('do something ajaxy',
> '/ajax_tests/practice/',
> array('update'=>'ajax'))); ?>
> -------------
>
> The following view is what will be displayed in div tag of the view
> mentioned above
> /views/ajax_tests/practice.thtml
>
> <?php echo('Theajaxcall worked'); ?>
> -------------
>
> -- layouts --
>
> You must create the following layout exactly as i have done. Don't try
> to figure out why!!
> /views/layouts/ajax.thtml
> <?php echo($content_for_layout); ?>
> -------------
>
> I hope that this helps and that it works. I wrote it on the fly
> without testing. If you have any problems, check to make sure that you
> put all of the views and layouts in their proper directories.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---