<div>Questions that deal with code are generally better suited for the development list; nevertheless, here are some tips to get you started. :)</div><div><br></div><div>You first need a query that returns the block&#39;s markup independent of anything else. In your own custom module, you would probably have to write your own AJAX menu callback in hook_menu() which *prints* (or uses drupal_json) of the hook_block() markup from uc_cart.module.</div>
<div><br></div><div>In your module&#39;s hook_init() you use drupal_add_js() to load a JS file that would implement the setInterval when the document is loaded. The best practice for this is in JS is to leverage Drupal.behaviors, e.g.,</div>
<div><br></div><div>Drupal.behaviors.foo = function() {</div><div>// setInterval stuff goes here to call AJAX menu callback specified in hook_menu().</div><div>}</div><div><br></div><div>Drupal.behaviors calls the specified function when the DOM is completely loaded (i.e. whenever Drupal.attachBehaviors is called). Check out Drupal.behaviors.password in modules/user/user.js for one such example.</div>
<div><br></div><div>Make sure you use proper access control in the hook_menu() callback. Also consider how this solution will scale.</div><div><br><div class="gmail_quote">On Thu, Jan 27, 2011 at 7:21 AM, John Mitchell <span dir="ltr">&lt;<a href="mailto:mitchelljj98@gmail.com">mitchelljj98@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I have a shopping cart block within the main pages that I want to refresh by calling the div called &quot;panel-pane pane-block pane-uc-cart-0&quot; every 2.5 seconds.<br>
<div style="display:inline">
</div><div style="display:inline"></div>What is the most efficient way to implement this?<br>

<br>I believe the way to call the javascript within drupal is by using the drupal_add_js() command but where do I put these commands so that the timer is run to refresh this shopping cart block every 2.5 seconds?  I have seen some documentation that recommends using hook_init for javascript that is needed for all pages.<br>

<br>I believe that the timer is setup by running the command:<br>        <i>setInterval(shoppingCartInfo, 2500);</i><br>With shoppingCartInfo being a command that does a call to refresh the shopping cart block which could be a set of ajax calls or maybe command like <i>window.panel-pane pane-block pane-uc-cart-0.refresh().<br>

</i><br>Thanks,<br><font color="#888888"><br>John<br><br>   <br>
</font><br>--<br>
[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br></blockquote></div><br></div>