Wednesday, August 31, 2011

Re: Pagination and JQuery: Passing parameters with JQuery to controller

hi paul,

yes, with the links href i am already passing the page number

controller/action/page:x

to my actions isAjax() function. but i need an additional parameter,
so my controller knows what element to render within the isAjax():
if ($this->RequestHandler->isAjax())
{


when user clicks on div "pagination_follow"
$this->render('/elements/users/following');
return;


when user clicks on div "pagination_created"
$this->render('/elements/users/created');
return;
}

i just cant get jquery to pass that additional variable....

On Aug 31, 9:56 am, WebbedIT <p...@webbedit.co.uk> wrote:
> The parameter(s) should already be in the link's href attribute, if
> not you're not using pagination to display your column sort and paging
> links?
>
> Have you read this (not done so myself, but should give you some
> pointers):http://bakery.cakephp.org/articles/daphonz/2008/05/03/easy-ajax-pagin...
>
> HTH, Paul
>
> On Aug 30, 8:59 am, Tomfox Wiranata <tomfox.wiran...@gmail.com> wrote:
>
>
>
> > thx, again ;)
>
> > stupid question. with ajax request you mean doing so within jquery,
> > correct? how would i do it here?
>
> > $('#pagination_created a').live('click', function() {
> >                     var url = $(this).attr("href");   !!!!!<<<<<<<<<<
> > I'm having a feeling that i need to add the parameter to this line
> >                     $('#following_popup').load(url);
> >                     return false;
> >                 });
>
> > thanks a lot :)
>
> > On Aug 30, 9:28 am, WebbedIT <p...@webbedit.co.uk> wrote:
>
> > > There is nothing special about achieving this as CakePHP takes the
> > > passed or named variables the same way as any other time.  Simply send
> > > an ajax request to:
>
> > > /controller/action/variableValue
>
> > > or
>
> > > /controller/action/variableName:variableValue
>
> > > If you're still struggling to access the variable in your action add
> > > echo debug($this->params); to see where the variable ends up.
>
> > > HTH, Paul.
>
> > > On Aug 29, 3:41 pm, Tomfox Wiranata <tomfox.wiran...@gmail.com> wrote:
>
> > > > hi huoxito,
>
> > > > thx for your post. no i didnt get there cause my way worked too.....
> > > > if you/someone know/knows how to pass a variable with jquery to the
> > > > isAjax() i'd rather stay with my solution, otherwise i might give it a
> > > > try..
>
> > > > On Aug 29, 2:22 pm, huoxito <huox...@gmail.com> wrote:
>
> > > > > Have u tried to do it use cake built in ajax pagination?
>
> > > > >http://book.cakephp.org/view/1600/Ajax-Pagination-Hidequoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: