hi
If you are trying to return JSON Object, I would suggest doing the
following
1. in your view/users folder, create a json folder
2. withing views/users/json folder create a get_user_details.ctp file
with the following code
<?php
echo $javascript->object($data); //converts PHP array into JSON object
array
?>
3. $data is whatever data you set in your controller. In your case it
will be
$this->set('data', array('success'=> true, 'data'=>
array('recordid'=>1, 'first'=>Jack,...........)
Regards,
bingo
On Dec 15, 7:31 am, majna <[EMAIL PROTECTED]> wrote:
> make getUserDetails.ctp
> set data from controller to this view.
> in view use, php json_encode
>
> On Dec 15, 10:56 am, Eli S <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi all,
> > I have spent a long time looking for a solution to this without luck.
>
> > I am trying to use the excellent JS library Extjs with cake 1.2 latest
> > build.
>
> > I am trying to make a simple ajax request to a controller
>
> > <?php
> > class UsersController extends AppController{
> > var $helpers = array('Html', 'Form', 'Javascript');
>
> > function admin(){
> > $this->layout = 'extadmin';
> > $this->set('users', $this->User->findById(18));
> > }
>
> > function getUserDetails(){
> > $this->layout = 'ajax';
> > echo("{success: true, data:{recordid:'1',
> > first:'Jack',
> > last:'Slocum', company:'Ext JS', email:'[EMAIL PROTECTED]',
> > state:'OH', dob:'04/15/2007', fee:'50'} }");
> > }
> > }
> > ?>
>
> > when making an Ajax request to /users/getUserDetails I get the
> > "Missing View" cakephp standard error response.
>
> > This really perplexes me because I would assume that with
> > layout='ajax' being set no view would be necessary.
>
> > If I wasn't bald I would be tearing my hair out right now!!- Hide quoted
> > text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---