Re: redirect in Ajax

2006-07-05 Thread baverman

Why not simply do the following thing:

function view($id){
  //Some code
  $this->render('view','ajax');
}

function add(){
  if ('valid post data'){
//Saving data
$this->view($id);
  } else {
$this->render('add','ajax');
  }  
}

Submit link in 'add' view will fill div with the 'view'.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: redirect in Ajax

2006-07-05 Thread francky06l

Well actually yes, I have tried and found 2 the solutions,depends if
you want to act only a certain controller/method or the complete
project :

* changes the redirect in app-controller :

if( $this->RequestHandler->isAjax())
{
 $this->requestAction($url, array('ajax'));
 exit(0);
   }
   else
parent::redirect()

That will affect all the controller ..and you use $this->redirect into
the controller function.

The second one, changes only into the function of the controller :

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

 $rc = $this->requestAction(url, array('ajax'));
 return $rc;
}

This affects only this function..

Thanks.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: redirect in Ajax

2006-07-05 Thread [EMAIL PROTECTED]

Couldn't you use requestAction() for this?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---