you can post it in cake style and use $this->data to access it (not by
using $_POST)

but besides that:
sure that "load" is a POST and not GET command?
what does firebug say?


On 13 Okt., 00:25, Tomfox Wiranata <tomfox.wiran...@gmail.com> wrote:
> hmm...why not??
>
> because i am sending data from my view to the controller? how else
> would i process a rating?
>
> On 13 Okt., 00:21, euromark <dereurom...@googlemail.com> wrote:
>
>
>
> > its not very cake like, what you are doing there, i'm afraid
>
> > On 13 Okt., 00:00, Tomfox Wiranata <tomfox.wiran...@gmail.com> wrote:
>
> > > saveRating is supposed to call the controller function "rate()" and
> > > passes the rating value:
>
> > >   $('#ratingt').load('rate', {data: ratingValue});
>
> > > the action is:
>
> > >         function rate()
> > >         {
> > >         $rating = $_POST['value'];
> > >         $this->set('rating', $rating);
> > >         $this->render('render_rating_count','ajax');
> > >         }
>
> > > I am rendering a view where the result is echoed. for testing
> > > purposes :)
>
> > > On 12 Okt., 23:50, Miles J <mileswjohn...@gmail.com> wrote:
>
> > > > Ok so whats the URL that saveRating() points to? And what does the
> > > > action look like.
>
> > > > On Oct 12, 2:40 pm, Tomfox Wiranata <tomfox.wiran...@gmail.com> wrote:
>
> > > > > hi,
>
> > > > > when a user clicks on a product link a url like this opens:   
> > > > > products/
> > > > > show/45
>
> > > > > 45 is the products id. this id is part of a select statement to
> > > > > retrieve the correct information from the database.
> > > > > controller function:
>
> > > > > show($id=null){
> > > > > some code...
> > > > >           SELECT * from products WHERE products.id=$id...;
> > > > > some code...
>
> > > > > }
>
> > > > > now the user has the opportunity to rate this product. after the user
> > > > > rated i wanna show the new result and the new count. of course with
> > > > > ajax feeling. so I use JQUERY to pass the rating value to a function
> > > > > named "rate".
>
> > > > >         $("#lkbl_rating_stars_list").stars({
> > > > >                 inputType: "select",
> > > > >                 cancelShow: false,
> > > > >                 callback:  function(value, link){
> > > > >                 saveRating();
> > > > >         }
> > > > >         });
>
> > > > > function saveRating()
> > > > > {
> > > > >                                 var ui = 
> > > > > $("#lkbl_rating_stars_list").data("stars");
> > > > >                                 var ratingValue = ui.options.value;
> > > > >                                 $('#ratingt').load('rate', {data: 
> > > > > ratingValue});
>
> > > > > }
>
> > > > > now cake throws error
> > > > > "Warning 512: SQL error. cant find column rate". looking at the sql
> > > > > statement that is generated:
>
> > > > > SELECT * from products WHERE products.id=rate...;
>
> > > > > that tells me, that jquery send the data thru the URL and somehow the
> > > > > $id is replaced by "rate"...which makes no sense :)
>
> > > > > HOW do I have to pass data with jquery to my controller without
> > > > > screwing with the url? is .load not correct?
>
> > > > > appreciate it. thanks

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@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