Hello,

i have looked at the issue again, and what you try to achieve is not really 
possible. Because ajaxLink generally creates jQuery javascript and attaches it 
to the jQuery stack which you render with <?= $this->jQuery(); ?> in your 
view.

Wenn you call the ajax content and return new links that are created with 
ajaxLink() their javascript cannot be attached to the jQuery stack anymore, 
because that has been rendered before.

What you could try is the following, in the two links that are generated 
through the ajax request set in the options 'inline'  => true, and in the 
previous linke set: 'dataType' => 'script', so that it would look like:

Normally generated link:
 array('update' => '#contentJ',
           'noscript' => false,
           'method' => 'POST',
           'dataType'=>'script'
 )

Ajax Requested Link:
<?php echo $this->ajaxLink(
        "[ Edit ]", "/admin/index/edit",
        array(  'id' => 'edit',
        'update' => '#contentJ',
        'noscript' => false,
        'inline' => true,
        'method' => 'POST'));

On Wednesday 26 November 2008 17:27:37 vladimirn wrote:
> Well, i added dataType to all 3 links, but no changes at all
>
> vladimirn wrote:
> > THank you for your quick reply.
> > Can you show me how to this, or point me somewhere where i can learn that
> > please?
> > And where to add that?
> > array('update' => '#contentJ',
> >           'noscript' => false,
> >           'method' => 'POST',
> >           'dataType'=>'html'
> > )
> > Like that?
> >
> > beberlei wrote:
> >> You have to give dataType = html as additoinal parameter to the options,
> >> because for
> >> security by default ajax responses are handled as text.
> >>
> >> On Wed, 26 Nov 2008 08:07:39 -0800 (PST), vladimirn
> >> <[EMAIL PROTECTED]>
> >>
> >> wrote:
> >>> I would like to figure this out:
> >>> On my index.phtml page is a link:
> >>> ------------------------------- index.phtml
> >>> --------------------------------------------------------
> >>> <?=$this->jQuery ();?>
> >>> <?=$this->ajaxLink(
> >>>                                                   "Home", 
> >>> "/admin/index/hello",
> >>>                                                   array('update' => 
> >>> '#contentJ',
> >>>                                           'noscript' => false,
> >>>                                           'method' => 'POST'));
> >>>                                                   ?>
> >>> ----------------------------- end of index.phtml
> >>> --------------------------------------------------
> >>>
> >>> DIV contentJ is somwhere within same index.phtml page.
> >>>
> >>>
> >>> This function calling my helloAction inside indexController where i
> >>> have:
> >>> ------------------------ part of indexController-
> >>> helloAction-------------------------------------
> >>> $news = $db->fetchAll ( $newssql );
> >>> $this->view->news = $news;
> >>> ------------------------ end
> >>> -----------------------------------------------------------------------
> >>>-
> >>>
> >>> and my hello.phtml view script showing:
> >>> ---------------------------- hello.phtml
> >>> -------------------------------------------------------------
> >>> <?php foreach ( $this->news as $news ) :?>
> >>> <?php echo $news['date'].' - '.$news['postedBy']?>
> >>>     
> >>> <?php echo $this->ajaxLink(
> >>>                                                   "[ Edit ]", 
> >>> "/admin/index/edit",
> >>>                                                   array(  'id' => 'edit',
> >>>                                                                   
> >>> 'update' => '#contentJ',
> >>>                                                                   
> >>> 'noscript' => false,
> >>>                                                                   
> >>> 'method' => 'POST'));
> >>> ?>
> >>>  
> >>> <?php echo $this->ajaxLink(
> >>>                                                   "[ Delete ]", 
> >>> "/admin/index/delete",
> >>>                                                   array(  'id' => 
> >>> 'delete',
> >>>                                                                   
> >>> 'update' => '#contentJ',
> >>>                                                                   
> >>> 'noscript' => false,
> >>>                                                                   
> >>> 'method' => 'POST'));
> >>> ?>
> >>>
> >>>                   <br>
> >>> <?php echo $news['newsText']?>
> >>>                   <br>
> >>>                   <br>
> >>> <?php endforeach; ?>
> >>> ----------------------------------end of hello.phtml
> >>> -------------------------------------------------------
> >>>
> >>> SO far you can see that i tried to create 2 links inside hello.phtml.
> >>> All
> >>> data are displayed, but [ Edit ] and [ Delete ] links are not links at
> >>> all,
> >>> just plain text.
> >>> Is it possible to make them as ajaxLink within given container
> >>> (contentJ)
> >>> and clicking on them, new content is pulled in contentJ div?
> >>>
> >>> Thanks a lot,
> >>> V
> >>>
> >>> --
> >>> View this message in context:
> >>
> >> http://www.nabble.com/jQuery-Ajax-link-inside-container--how-to-make-thi
> >>s--tp20703903p20703903.html
> >>
> >>> Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
Benjamin Eberlei
http://www.beberlei.de

Reply via email to