Error in code. missed "}" in beforeFilter. What do you see in default layout? Error? Or only "DUMMY" text?
Never set debug to 0 in beforeFilter, do it in afterFilter or you never see actual errors. On Oct 4, 11:51 pm, Cергей Inhbgkbyu <[email protected]> wrote: > Hello 2all! > > I'm stuck with simple ajax request. > First of all, I've tried this > solution:http://groups.google.com/group/cake-php/browse_thread/thread/869eb34c... > Works nothing. > Google leads to the same solution. > Controller code: > 1 <?php > 2 class MenusController extends AppController { > 6 var $helpers = array('Html','Ajax','Javascript'); > 7 var $components = array( 'RequestHandler' ); > 15 function beforeFilter(){ > 16 if($this->RequestHandler->isAjax()){ > 17 Configure::write('debug', 0); > 18 $this->layout = 'ajax'; > 19 } > > 30 function ajax_test( $par ){ > 31 $this->layout="ajax"; > 32 echo "DUMMY"; > 34 } > 35 } > 36 ?> > > Part in the view: > > 17 echo $ajax->link( > 18 'Test', > 19 array( 'controller' => 'menus', 'action' => 'ajax_test', 1 ), > 20 array( 'update' => 'cart' ) > 21 ); > > And I get default layout in response. What am I doing wrong? > > -- > Please avoid sending me Word, PowerPoint or Excel attachments. > Seehttp://www.gnu.org/philosophy/no-word-attachments.html > > xmpp: [email protected] > xmpp: [email protected] > skype: rakoth_s --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
