Note that there are some explanatory texts on larger screens.

plurals
  1. POYii: How to render partial dynamically JavaScript widgets
    primarykey
    data
    text
    <p>I have a problem with dynamically reloading of areas in html file. I use an Ajax based approach. I successfully update the area of my interest (HTML div tag), but every time I do an update the same JavaScript gets downloaded and processed along with the replacement html code, which consumes time. I want that browsers reuse, on AJAX update, the last downloaded JavaScript file instead fetching its same content again and again, which results in excessive overhead. What I mean? Let's say I have a <code>Button Widget</code> which has <code>widget.js</code> JavaScript attached to it. This JavaScript will be responsible for the event triggered on button click. Every time this button is clicked, the event will 'shoot' AJAX request and particular area on HTML page gets updated along with a download of <code>widget.js</code> if necessary. I want that <code>widget.js</code> is downloaded only the first time, but currently it gets downloaded on every AJAX request. What I noticed is that every time the mentioned JavaScript file is requested with an appended query parameter <code>_</code> with random value.</p> <pre><code>widget.js?_=1374504824837 </code></pre> <p>How can I disable this random parameter?</p> <p>my <strong>index.php</strong></p> <pre><code>&lt;p&gt; &lt;div id='widget-container'&gt; &lt;?php $this-&gt;renderPartial('widget'); ?&gt; &lt;/div&gt; &lt;/p&gt; </code></pre> <p>my <strong>controller</strong></p> <pre><code>public function actionWidget() { $this-&gt;renderPartial('widget',array(),false,true); } </code></pre> <p>my <strong>widget.php</strong></p> <pre><code>&lt;?php $url = 'widget'; $update = '#widget-container'; $this-&gt;widget('ext.bootstrap.widgets.TbButton', array('label' =&gt; 'Widget', 'size' =&gt; 'medium', 'buttonType' =&gt; 'ajaxButton', 'url' =&gt; $url, 'ajaxOptions' =&gt; array('type' =&gt; 'POST', 'update' =&gt; $update, 'cache' =&gt; false), 'htmlOptions' =&gt; array('id' =&gt; 'widget'.uniqid()) ) ); ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload