I checked, it seems that the Session breaks, what do I have to do so
it won't?

thx
Aurelius

On 5 Apr., 02:46, Miles J <mileswjohn...@gmail.com> wrote:
> Heres an example of my js and action. Btw im using jquery.
>
> // Js
> function deleteAvatar(user_id) {
>         $.ajax({
>                 type: "POST",
>                 url:  "/ajax/deleteAvatar/",
>                 data: "data[user_id]="+ user_id,
>                 success:
>
>                 function (response) {
>                         // Do something with response
>                 }
>         });
>
>         return false;
>
> }
>
> // Action
> function deleteAvatar() {
>         $user_id = $this->Auth->user('id');
>         $owner_id = $this->data['user_id'];
>
>         if ($this->validRequest($owner_id) && $user_id == $owner_id) {
>                 if ($this->User->deleteAvatar($this->Auth->user())) {
>                         $this->_refreshAuth('avatar', '');
>
>                         echo 'pass';
>                         return;
>                 }
>         }
>
>         echo 'fail';
>         return;
>
> }
>
> The echos are my js response, and validRequest() is a custom method I
> wrote.
--~--~---------~--~----~------------~-------~--~----~
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