first, thx to everyone..

I am using 1.3 and i dont mind using POST instead of GET. seems to
make more sense anyay.... so based on both of your answers I'll try

to use a form , sending with post and accept the data in my controller
via request..

@ EUROMARK:

so when i send the data with ajax to my controller, how should I
receive it? with this->params? or $_POST????

why do you use Jquery instead of # ? do i need to import a specific
jquery file to make that work? i got the jquery1.4.2 already

thx :)

On 13 Okt., 11:46, euromark <[email protected]> wrote:
> use jquery .ajax()
> this will work
>
> example:
>
> jQuery('.delAjax').click(function(e) {
>         e.preventDefault();
>         var targeturl = jQuery(this).attr("href");
>         var id = jQuery(this).parent('td').parent('tr');
>                 $.ajax({
>                         type: "post", url: targeturl,
>                         //beforeSend: showRequest, //show loading just when 
> link is clicked
>                         //complete: showResponse, //stop showing loading when 
> the process
> is complete
>                         success: function(html){ //so, if data is retrieved, 
> store it in
> html
>                                 if (html == '') {
>                                         id.hide();
>                                 } else {
>                                         alert(html);
>                                 }
>                                 }
>                 });
>         });
>
> On 13 Okt., 11:17, Michael T <[email protected]> wrote:
>
> > I had similar problems like yours and I found that using Firebug to
> > debug what was being sent back to the server via Javascript was *very*
> > helpful. If you haven't done so already, you should install it.
>
> > What version of CakePHP are you using? I know that in 1.3 you can use
> > the JsHelper's 'request' method and you can specify that it does a
> > POST instead of a GET. But this might only work if you employ a
> > <form>.
>
> > Otherwise, if you want to continue using GET, can't you just get the
> > passed value from $this->params['url']['value'] ?
>
> > Hope this helps.
>
> > On Oct 13, 9:30 pm, Tomfox Wiranata <[email protected]> wrote:
>
> > > but dont I need a form when I use this->data??? and still i have to
> > > pass them in my view. but how?
>
> > > just checked....the load function is a get command, saysd
> > > api.jquery.com
> > > "This method is the simplest way to fetch data from the server. It is
> > > roughly equivalent to $.get(url, data, success) "
>
> > > so i definitely have to find a different way to pass data to my
> > > controller.....!!!!
>
> > > thanks
>
> > > On 13 Okt., 00:40, euromark <[email protected]> wrote:
>
> > > > 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 <[email protected]> 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 <[email protected]> wrote:
>
> > > > > > its not very cake like, what you are doing there, i'm afraid
>
> > > > > > On 13 Okt., 00:00, Tomfox Wiranata <[email protected]> 
> > > > > > 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 <[email protected]> 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 <[email protected]> 
> > > > > > > > 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 [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

Reply via email to