[development] How can I tell from the returned value (i.e. drupal_add_js('shoppingCartInfo()', 'inline')) whether this javascript has been successful called so that I can stop the call to this javascript function the next time the hook is executed?

John Mitchell mitchelljj98 at gmail.com
Sun Feb 6 06:39:22 UTC 2011


I am using the hook_cart_item in order to perform some javascript after an
item has been added to the shopping cart.  It appears to be called multiple
times for just one "add to cart"  click (i.e. if have 1 item in the shopping
cart then hook is called 5 times and 2 items it is called 10 times) and I
only want to run this javascript once.  I have set it up so that the
javascript is only called during the first time that this hook is executed
but I have found that the javascript is not executed for this first
iteration but instead is executed during a later iteration, and that it only
executed once for each item within the shopping cart.

My question is how can I tell from the returned value (i.e.
drupal_add_js('shoppingCartInfo()', 'inline')) whether this javascript has
been successful called so that I can stop the call to this javascript
function the next time the hook is executed?

Thanks,

John

-- 
John J. Mitchell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20110206/f0b9884e/attachment.html 


More information about the development mailing list