I don't think you're understanding how a webpage works. JavaScript
can't invoke PHP functions or any server-side functions. JavaScript is
client-side. It's executed in the browser. The browser can send
requests to the web server for web _pages_. That's what
window.location does--it tells the browser to request the webpage at
that location. You can't redirect a browser to a "function".

You _can_, however, redirect the browser to a URL that represents a
controller "action". If you don't know the standard URL for a
controller action is, then you need to read the Cake Cookbook. The
standard routing pattern for Cake is one of the most basic concepts
you need to know for Cake development. So if you don't know that,
chances are you haven't bothered to read the Cookbook at all, which is
going to make developing a proper Cake application close to
impossible. So start here:

http://book.cakephp.org/view/879/Beginning-With-CakePHP

The specific info you are looking for with regards to this question is
here:
http://book.cakephp.org/view/945/Routes-Configuration

But I highly recommend at least skimming through the first 3 chapters
of the Cookbook, if not the entire Cookbook. It will save you _so_
much trouble (trust me).

On Jun 4, 1:22 pm, "[-Cheluis-]" <[email protected]> wrote:
> How to redirect to another controller/function. From html you can do
> something like:
>
> <?php echo $html->link('Message',
> array('controller'=>'x','action'=>'y',$parm); ?>
>
> How can I do this from js? window.location is enough?
>
> Thanks
>
> On Jun 4, 10:43 am, calvin <[email protected]> wrote:
>
> > Are you asking how to redirect to a different page in JavaScript?
> > That's not really Cake-related, but it's window.location = 'your new
> > page'.
>
> > On Jun 3, 9:49 pm, "[-Cheluis-]" <[email protected]> wrote:
>
> > > Hi! I was wondering if there is a way to redirect from one action to
> > > another via javascript. I want to do some validations and then,
> > > redirect the flow to one specific action.
>
> > > Any ideas?
>
> > > thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" 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