cake-php@googlegroups.com
[Top] [All Lists]

Re: need to load a paging controller through jQuery

Subject: Re: need to load a paging controller through jQuery
From: John Andersen
Date: Tue, 27 Apr 2010 12:33:29 -0700 PDT
Can I assume that in your list function, when you are checking for
$this->params['requested'], that means that it is an ajax request,
correct?

Anyway, if I am right in my assumption, then what you are returning is
the paginated data array, not a rendered view of the list.
Hope this helps you on the way!
Enjoy,
   John

On Apr 27, 10:21 pm, sherzo <shahrzad.azimi...@xxxxxxxxx> wrote:
> Hi All
>
> I'm trying to load a paging list inside a DIV in another list through ajax
> jQuery. lists view is working perfectly but it seems that for some reason
> jQuery can not load it inside a div in another view!!!
>
> here is my javascripts in th eheader:
>
> <script type="text/javascript">
> function loadPiece(href,divName) {    
> $(divName).load(href, {}, function(){
>        $(divName).find("a").each(function(i){
>          $(this).bind('click', function(){
>            var thisHref = $(this).attr("href");
>            loadPiece(thisHref,divName);
>            return false;
>          });
>        });
>    });  }
>
> </script>
>
>    <script type="text/javascript">
>          $(document).ready(function() {
>            loadPiece("<?php echo
> $html->url(array('controller'=>'users_coupons','action'=>'lists'));?>","#my_coupons");
>             });
>    </script>
>
> here is the div part in the view:
>
> <div id="Kuponlarim">
> <div class="kupon" id = "my_coupons">
> </div>
> </div>
>
> and here is my lists method in the controller
>
> function lists(){
>  $this->UsersCoupon->recursive = 2;
>  $this->paginate = array(
>           'conditions' => array('UsersCoupon.user_id' =>
> $this->Session->read('Auth.User.id')),
>           'limit' => 5
>   );
> if(isset($this->params['requested'])) {
>             return $this->paginate('UsersCoupons');
>        }
>        $cops = $this->paginate('UsersCoupon');
>   $this->set('usersCoupons',$cops);
>
> }
>
> any idea???
> --
> View this message in 
> context:http://old.nabble.com/need-to-load-a-paging-controller-through-jQuery...
> Sent from the CakePHP mailing list archive at Nabble.com.
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@xxxxxxxxxxxxxxxx
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
cake-php+unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

<Prev in Thread] Current Thread [Next in Thread>