thanks for the info.
correct if I'm wrong with this one. In my case, indexSuccess was not being 
called by other ajax request. what was being called is the partial 

    <div id="mycart">
         <?php include_partial("companyproduct/cart") ?>
    </div> 
from indexSuccess.php.

from indexSuccess.php ajax to -> action returns renderPartial. does this make 
any sense?
I also tried to return a variable. but it still not updated.

I'm actually new using this ajax thing. please bare with me.




________________________________
From: Gareth McCumskey <[email protected]>
To: [email protected]
Sent: Thu, September 2, 2010 5:08:06 AM
Subject: Re: [symfony-users] link_to_remote help. please take a look.

One small thing to simplify, in your action change the line:

if($request->getParameter('prodid') && 
is_null($request->getParameter('prodid')) 
== false)

To look like:

if($request->getParameter('prodid', -1) !== -1)

The second parameter if getParameter() is the default value if the parameter 
does not exist.

Also, is the indexSuccess.php being called as a result of another AJAX request? 
If so, ensure that script=>true is set on any AJAX request that may result in 
indexSuccess.php being called as well.


On Thu, Sep 2, 2010 at 10:33 AM, Andro Fumero <[email protected]> wrote:

hello everyone,
> 
>my script is not able to update div content using link to remote. below is my 
>code. please tell me if i miss something.
> 
>indexSuccess.php [
>    <div id="mycart">
>         <?php include_partial("companyproduct/cart") ?>
>    </div> 
> 
>    <td>
>    <?php foreach ($pager as $companyproduct): ?>
>         <?PHP  echo link_to_remote('Add to Cart',
>          array(  
>              'update'  => 'mycart',
>              'url'     => 
>'companyproduct/Addtocart?prodid='.$companyproduct->getId(),
>              'return' => 'true',
>              'script' => true,
>              ), array('class'  => 'ajax_link',
>              )) ?>
>  </td> 
>    <?php endforeach; ?>
>]
> 
>ACTIONS: 
>executeAddtocart(sfWebRequest $request)[
>      if($request->isXmlHttpRequest()) {
>           if($request->getParameter('prodid') && 
>is_null($request->getParameter('prodid')) == false)
>           {
>                $this->getUser()->addToCart($request->getParameter('prodid'));
>                return $this->renderPartial('companyproduct/cart');    
>           }
>           $this->setLayout(false);
>      }
>]
>When I check the firebug POST HTML. the return is already updated.
>result: YourCartItems(5)
> 
>but in my IndexSuccess.php is still YourCartItems(4). I still need to refresh 
>it  in order to view the updated one.
> 
>Thank you all.
>
-- 
>If you want to report a vulnerability issue on symfony, please send it to 
>security at symfony-project.com
> 
>You received this message because you are subscribed to the Google
>Groups "symfony users" 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/symfony-users?hl=en
>


-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com
 
You received this message because you are subscribed to the Google
Groups "symfony users" 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/symfony-users?hl=en



      

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" 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/symfony-users?hl=en

Reply via email to