0

When setting $this->layout = 'ajax' cake still expects the view file for that action.

My question is, do I still need to create that view file, or is there a way to circumvent that. I don't wish to have ajax actions with one-liner view files such as '<?php echo $data; ?>'

1 Answer 1

0

try this in your ajax method. Then you don't need page for your ajax method

public function action_name() { $this->layout = 'ajax'; ... ... $this->autoRender = false; echo $data; } 
Sign up to request clarification or add additional context in comments.

3 Comments

$this->Layout !== $this-layout !
the above answer works ! Thanks! @mark, what is wrong with the answer? Or what you suggested is just another way of doing it ?
It implies that $this->Layout is wrong and the documented $this->layout should be used instead. And that one should mind the casing. I took the liberty of correcting the answer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.