Hello,
I am trying to work with ajax helper to do a comments form on a test
blog system.
I am fairly new...but have managed to pick most things up...but this
is doing my head in!
Okay so I show a blog post and people can comment on them so I use
this in the view file:
<?php echo $ajax->form(null,'post',array
('update'=>'comment','url'=>array
('controller'=>'comments','action'=>'add')));
?>
<?php echo $form->input('Comment.name'); ?>
<?php echo $form->input('Comment.content'); ?>
<?php echo $form->input('Comment.post_id', array
('type'=>'hidden','value'=>$post['Post']['id'])); ?>
<?php echo $form->end('Add Comment'); ?>
-------
then the logic for this in the Comments controller / add function is :
function add() {
if(!empty($this->data)){
$this->Comment->create();
if($this->Comment->save($this->data)) {
$comments=$this->Comment->find('all',array('conditions'=>array
('post_id'=>$this->data['Comment']['post_id']),'recursive'=>-1));
$this->set(compact('comments'));
$this->render('add_success','ajax');
}else{
$this->render('add_failure','ajax');
}
}
}
..........now it all displays good......BUT when I click 'Add Comment'
It doesnt do ANYTHING!!!!!!!!!!! I have searched high and low and
cannot find any help on the web, so I am hoping some superstar on here
can help??
WHY is it not doing ANYTHING....atleast if I got an error I could take
it from there, but I get NOTHING!
PLEASE HELP!!!!!!!!!!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---