Re: ajax helper for updating a div

2010-09-10 Thread francky06l
Can you check first if your ajax call is running (using Firebug on FF
or same) .. Long time I haven;t work with prototype, I prefer
jQuery ...

On Sep 9, 3:44 pm, Tomfox Wiranata  wrote:
> thx Dmitry...i tried to implement sth, based on your proposal
>
> ok for testing purpose i created an ajax view called   "neat"
>
> 
>                 echo "if you see this, ajax works";
>  ?>
>
> and this is my ajax link in a view called "render_attachment"
>
>                                 echo $ajax->link('x', array('controller' => 
> 'links', 'action' =>
> 'test'), array('update' => 'divi'));
>
>                                 echo $ajax->div('divi');
>                                 echo $ajax->divEnd('divi');
>
> now the test() fct in my controller looks like this
>
>         function test()
>         {
>                 $this->render('neat', 'ajax');
>         }
>
> but nothing happens...no "if you see this, ajax works" text appears
> from the view i tried to render with ajax..
>
> any idea whats going wrong here?
>
> thank you :)

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


Re: ajax helper for updating a div

2010-09-09 Thread Tomfox Wiranata
thx Dmitry...i tried to implement sth, based on your proposal

ok for testing purpose i created an ajax view called   "neat"





and this is my ajax link in a view called "render_attachment"

echo $ajax->link('x', array('controller' => 
'links', 'action' =>
'test'), array('update' => 'divi'));


echo $ajax->div('divi');
echo $ajax->divEnd('divi');


now the test() fct in my controller looks like this

function test()
{
$this->render('neat', 'ajax');
}


but nothing happens...no "if you see this, ajax works" text appears
from the view i tried to render with ajax..

any idea whats going wrong here?

thank you :)

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


Re: ajax helper for updating a div

2010-09-09 Thread Dmitry Shevchenko
Hi,
1.
place $this->render('your ajax view'); into controller
deleteattachment() function

2. you can add your variables to url
will look like
array('controller' => 'linkables', 'action' => 'deleteattachment',
param1,param2

and it will be available in the controller as $this->params.

try to pr($this); to see all available data;

On Sep 9, 3:01 pm, Tomfox Wiranata  wrote:
> hi,
>
> again, ajax is driving me nuts. shocker! :)
>
> I have a certain DIV that echoes data from a table. with each data row
> comes an ajax link to delete it. when a user clicks that link, a
> delete() function in my controller deletes that certain data and this
> DIV is supposed to update. I found some code for orientation, but it
> wont work.
>
> the View "render_attachment.ctp" echoes the data from my table and has
> the ajax link:
>
> 
>     echo $javascript->link('prototype');
>     echo $javascript->link('scriptaculous');
>
> ?>
>
>         
>                 foreach ($attachments as $attachment):
>
>                 echo $attachment['LinkTmp']['name'];
>                 echo $ajax->link('x', array('controller' =>
> 'linkables', 'action' => 'deleteattachment'), array('update' =>
> 'attachment_div'));
>
>         ?>
>
>                 
>
>         
>
> the render_attachment.ctp View is called after a file-upload-process
> to show the user what files he uploaded:
>
>     function __renderattachment()
>     {
>         $this->set('attachments', $this->Link->LinkTmp->find('all',
> array('conditions' => array('LinkTmp.ed =' => $this -> Session ->
> read('Link.eyed'), 'LinkTmp.attachment' => '1';
>         $this->render('render_attachment','ajax');
>     }
>
> Now with the ajax link I try to call the "deleteattachment()" fnction
> in my controller, that acutally deletes that data from the table:
>
>         function deleteattachment($name)
>         {
>                 $this->Link->LinkTmp->deleteAll(array('LinkTmp.eyed' => $this 
> ->
> Session -> read('Link.eyed'), 'LinkTmp.name'  => $name));
>
>         }
>
> so, how do I
>
> a) tell cake to render my view "render_attachment.ctp" in the DIV that
> i defined in the link, after i called deleteattachment() ?
>
> b) how can i pass variables to deleteattachment() with my ajax link?
>  echo $ajax->link('x', array('controller' => 'linkables', 'action' =>
> 'deleteattachment'), array('update' => 'attachment_div'));
>
> thx :)

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