Yea I changed method to type, but it still isn't working.

Here is my code for the controller (if you don't know CakePHP, this
likely won't mean anything to you):

                function view($slug)
                {
                        if ($this->RequestHandler->isAjax())
                        {
                                $dbdirector = $this->Director->find('first', 
array(
                                        'conditions' => array(
                                                'Director.slug' => 'slug'
                                        ),
                                        'fields' => array(
                                                'Director.id', 'Director.name', 
'Director.description',
'Director.picture'
                                        )
                                ));
                                $this->set('dbdirector', $dbdirector);

                                Configure::write('debug', 0);

                                $this->pageTitle = 'URSU - Director ' . 
$dbdirector['Director']
['name'];
                        }
                        else
                        {
                                $this->redirect('/directors/');
                                $this->exit();
                        }
                }

And my code for my corresponding view.ctp file:

<?php
        echo $html->image('/img/directors/uploads/thumb.medium.' . $dbdirector
['Director']['picture'], array('alt' => $dbdirector['Director']
['name']));

        echo $dbdirector['Director']['description'];

        if ($admin)
        {
                echo '<div class = "admin">';
                        echo $html->link('Edit Director', '/directors/edit/' . 
$dbdirector
['Director']['id']);
                        echo ' --- ';
                        echo $html->link('Delete Director', 
'/directors/delete/' .
$dbdirector['Director']['id'], null, 'Are you sure you want to delete
this director?');
                echo '</div>';
        }
?>

What happens is a person goes to the index page, clicks a link, this
gets processed by the AJAX request, which sends it off to function view
($slug), which sets all the data and sends that data to view.ctp,
which then creates all of the html which I was hoping would be
injected into the div set in the ajax request.

On May 8, 9:16 am, "Mauricio \(Maujor\) Samy Silva"
<css.mau...@gmail.com> wrote:
> >Awesome, Mauricio had the right solution. I had figured that e was
> >working on the link, but now that I think about it, that makes no
> >sense. So that works, now I have to figure out how to inject the
> >incoming html, because apparently that's not working, just not sure
> >yet if it's my javascript or my PHP (I'm working with CakePHP).
>
> -------------------------------------------------------
> It appear that there is nothing wrong with the jQuery sintax.
> Does you made what Arak pointed?
>
> method: 'get'
> should be:
> type: 'get'
>
> Maurício

Reply via email to