So by "normal response when called by AJAX" you mean that the whole layout
should be returned? Then it's just a matter of setting your layout
accordingly, isn't it?

Or do you mean more like handling the action redirect?

If you are redirecting within the same controller then use setAction passing
along your parameters:

return $this->setAction('/controller/action', $parameters);

If you want the result of the AJAX call to be a full site redirect instead,
then on your index.html have something like:

<?php echo $ajax->div('updateableDiv'); ?>

<form method="post" id="finished_topics_form" name="finished_topics_form" onsubmit="return false;"> ... <?php echo $ajax->submit(' Publish selected ', array( 'update' => 'updateableDiv', 'id' => "publish_button", 'name' => "data[Button][publish]", 'url' => "/editors/topics_publishing" )); ?> ... </form>

<?php if (isset($url)) echo $javascript->codeBlock('window.location = "' .
$url . '";'); ?>

<?php echo $ajax->divEnd('updateableDiv'); ?>

Then on your editors controller add RequestHandler as a component and do:

function topics_publishing() { if ($this->RequestHandler->isAjax())
        {
                $this->set('url', '/newurl');
        }
        else
        {
                return $this->redirect('/newurl');
        }
}

-MI

---------------------------------------------------------------------------

Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge.
BAKE ON!


-----Mensaje original-----
De: [email protected] [mailto:[EMAIL PROTECTED] En nombre
de igor
Enviado el: Domingo, 24 de Diciembre de 2006 12:30 p.m.
Para: Cake PHP
Asunto: Re: Rendering non-ajax view after calling action with ajax call

Thanks for answer, but I wasn't asking for that. I used Ajax.Updater
before and what You have described I already used.

I will try to explain differently:

If I call my action like usual (ie. non-ajax):
http://myserver/mycontroller/myaction/
I get "normal" response. OK?

I want to have that normal response even If I call this action with
Ajax.Request (using cake's $ajax->submit() or plain Prototype's
Ajax.Request)

So... I HAVE that Ajax.Request working. But, I need response to
redirect my browser to action I called and with params I sent).

Any better now? :)


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to