Sunday, October 7, 2012

loading comments page with jQuery

hi guys,... I switching to jQuery from Prototype on cake1.3
and I want to load comments page from... /profile_comments/ajax_show.ctp to profile ../user/show.ctp page,... but its not loading... 
and I have latest jquery Javascripts in place... can anyone help please... 

this is my /users/show.ctp 

    <div id="comments"></div>

<script>
  $("#comments").load("<?php echo $html->url('/profile_comments/ajax_show/profile_id:' . $user_obj['User']['id']) ?>");
</script>

this is my function: 

  
  function ajax_show()
  {
    $this->layout = 'empty';
    $id = array_key_exists('profile_id', $this->params['pass']) ? $this->params['pass']['profile_id'] : null;
    
    if(!($user = $this->User->findById($id)))
    {
      die();
    }
    else
    {
      $this->set('url_options', array('profile_id' => $id));
      $this->set('user_obj', $user);
      $this->set('profile_comments', $this->paginate('ProfileComment', array('profile_id' => $user['User']['id'])));
      $this->set('offset', ($this->params['paging']['ProfileComment']['page'] - 1) * $this->paginate['limit'] + 1);
    }
  }

and it must load a page from ../profile_comments/ajax_show 
 BUT IT's NOT DOING ANYTHING...

verses to Prototype which works in cake1.2 version 

    <div id="comments"></div>

    <script>
    new Ajax.Updater("comments", "<?php echo $html->url('/profile_comments/ajax_show/profile_id:' . $user_obj['User']['id']) ?>", { evalScripts:true, onComplete:function() { $("comments_loading").hide() } });
    </script> 


thanks in advance 
chris 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate