Monday, July 27, 2009

Weired cakePHP behavior!!

I'm doing ajax call on some models ,and the 1st code seems to be
workin' , but the second one is not !

I'm simply retrievin' data from database and print it in JSON format :

this is my view :
echo $javascript->object($category);

this code work perfectly
Configure::write('debug', 0);
$this->layout = 'ajax';
$this->RequestHandler->setContent('json', 'text/javascript');
$this->RequestHandler->respondAs('json');
$this->Category->recursive = 2;
$this->set('category', $this->paginate());


this code won't work!!!
Configure::write('debug', 0);
$this->layout = 'ajax';
$this->RequestHandler->setContent('json', 'text/javascript');
$this->RequestHandler->respondAs('json');
$this->set('category', $this->Category->read(null, 1));//here I'm
just getting the record with the id 1

it's little confusing 4 me how can the first code work and the second
one not

regards
Abraham
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: