Yea, I'm sorry, I had fixed that problem a little while ago, that
isn't the solution to the problem, it's still not working, and the
page is still trying to load instead of working via AJAX.

This is my code for the buttons I am making if that makes a
difference.

echo $html->link($html->image('/img/about/uploads/thumb.small.' .
$links['About']['picture'], array('alt' => $links['About']['name'])),
'/about/view/' . $links['About']['id'], array('id' => 'ajax_replace'),
false, false)

I'm not so sure the problem is with the javascript, I mean it totally
could be, however I have found a few AJAX tutorials in MooTools, and
the code I have is relatively copied. However I have found no
tutorials anywhere regarding using MooTools AJAX with CakePHP, so
what's really bothering me is the setting up the controller and how
the associated view(s) should be set up.

On Mar 9, 3:10 am, r4zv4n <razvanbra...@gmail.com> wrote:
> Hi,
>
> The fact that the page is loading instead of the Ajax request being
> sent should signal that there's an error in your JS (if it were a Cake
> err, you would have had weird responses).
>
> Upon closer inspection, here is the problem:
>
> $('ajax_replace').addEvent('click', function(
>         {
>                 req.send();
>         });
>
> ..should actually be:
>
> $('ajax_replace').addEvent('click', function()
>         {
>                 req.send();
>         });
>
> (you simply missed a closing parenthesis)
>
> Tip: use Firefox with FireBug  - you would have seen the error
> sooner ;)
>
> On Mar 9, 12:36 am, "Arak Tai'Roth" <nielsen.dus...@gmail.com> wrote:
>
> > I tried that, and removed my autoRender and exit() lines and added in
> > $this->render(index); It didn't work.
>
> > The page is still loading, which it shouldn't be with an AJAX request
> > as far as I know.
>
> > In addition I added a $this->Session->setFlash('message'); inside the
> > isAjax() if statement and it doesn't pop up.
>
> > I should also say that I have multiples of these links
> > ('ajax_replace'), not just one, if that makes a difference.
>
> > As well, I have two views right now, I have my index.ctp view which is
> > displaying the links and the first content that comes up (a picture
> > and some text), then I have my vew.ctp which currently is only holding
> > the content that I want to show where the current picture and text is.
> > So I'm not entirely sure if I even have this setup correctly.
>
> > On Mar 8, 3:17 pm, "Websta*" <subscripti...@webprogression.co.nz>
> > wrote:
>
> > > Assuming your request is running - and i can see no reason why it
> > > wouldnt as long as you have the correct html elements in use then i
> > > suspect your problem lies here:
>
> > > $this->autoRender = false;
> > > exit();
>
> > > By doing this your teling your controller not to render after the
> > > action, and then your exiting so nothing at all gets output.
>
> > > So either get rid of those lines altogether or if you want to forcibly
> > > render a specific view replace it with $this->render(myView);
>
> > > hth
>
> > > Paul
>
> > > On Mar 8, 6:09 pm, "Arak Tai'Roth" <nielsen.dus...@gmail.com> wrote:
>
> > > > I am trying to update a div via ajax, however I am using MooTools, and
> > > > not the normal Prototype and Scriptaculous.
>
> > > > Here is the code that I have in my controller:
> > > > function view($id)
> > > >                 {
> > > >                         if ($this->RequestHandler->isAjax())
> > > >                         {
> > > >                                 $dbabout = $this->About->find('first', 
> > > > array(
> > > >                                         'conditions' => array(
> > > >                                                 'About.id' => $id
> > > >                                         ),
> > > >                                         'fields' => array(
> > > >                                                 'About.id', 
> > > > 'About.name', 'About.picture', 'About.description'
> > > >                                         )
> > > >                                 ));
> > > >                                 $this->set('dbabout', $dbabout);
>
> > > >                                 Configure::write('debug', 0);
> > > >                                 $this->autoRender = false;
>
> > > >                                 exit();
> > > >                         }
> > > >                         else
> > > >                         {
> > > >                                 $this->redirect('/about/');
> > > >                                 $this->exit();
> > > >                         }
> > > >                 }
>
> > > > and then my ajax:
> > > > window.addEvent('domready', function()
> > > > {
> > > >         var req = new Request.HTML(
> > > >         {
> > > >                 url: $('ajax_replace').get('href'),
>
> > > >                 onSuccess: function(html){
> > > >                         $('about_descriptioncontent').adopt(html);
> > > >                 }
> > > >         });
>
> > > >         $('ajax_replace').addEvent('click', function(
> > > >         {
> > > >                 req.send();
> > > >         });
>
> > > > });
>
> > > > The problem is nothing is happening, plus when I click one of the
> > > > links it looks like the page itself is re-loading, which shouldn't be
> > > > happening if it's Ajax. I have the view controller sending data to
> > > > view.ctp, which I was hoping would be adopted in the div I want to
> > > > update as per the ajax above.
>
> > > > If anyone can help me out with this that would be awesome, thanks in
> > > > advance.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to