AJAX processing is very strange and called at very strange times. Try to move your logic from beforeFilter() to beforeRender(). If nothing helps you can hack RequestHandler to not re-set Content- Type...
On Dec 3, 11:25 am, "starchild.no1" <[email protected]> wrote: > Hi all, > > I'm doing an ajax update to see if username exsist.. However when I > use the standard RequestHandler markup in my AppController or Users > Controller beforeFilter > --------------------------------------------------------------------------- > --------- > function beforeFilter(){ > if ($this->RequestHandler->isAjax()) > { > Configure::write('debug', 0); > $this->disableCache(); > $this->RequestHandler->respondAs('js'); > $this->viewPath = $this->params['controller']; > $this->viewPath .= "/js"; > }} > > --------------------------------------------------------------------------- > ----------- > My Content-Type come back as text/html in my headers when viewed in > firebug.. And my hidden divs does not show giving me notice if > username taken or exist. > > But when i put: > > $this->RequestHandler->respondAs('js'); > --------------------------------------------------------------------------- > -------------------- > in my available action: > > function available() { > > $this->RequestHandler->respondAs('js'); > > if (!empty($this->params['form']['slug'])) { > if ($this->User->hasAny(array('slug' => $this->params['form'] > ['slug']))) > { > $this->message('warning', "Username '{$this->params['form']['slug']}' > already in use. Please try another one."); > } > $this->message('success', "Username '{$this->params['form']['slug']}' > is available."); > } > else > { > $this->message('warning', 'Please enter a username.'); > }} > > --------------------------------------------------------------------------- > -------------------------- > > then my Content-Type in my headers read text\javascript and everything > works fine?? > > Can anyone suggest what could be causing this? 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
