Dynamic Div Load In Yii

Hello Everyone,

  Here i am going to ask another silly question. 

I have customized page called ‘uploadindex.php’ under ‘Files’ controller.

In this page, one operation needs longer time to execute.

So, what I need to put the operation under a div and load it dynamically after the page load just like "jquery load" function.

let the div id is "LoadDiv". Now in yii what is the easiest and simplest way to call the div to load after the page has been loaded?

if The question is not clear, please tell me.

Any feedback will be a big help for this newbie.


Does ‘renderpartial’ render the specific part using ajax ? It should be, but I am not seeing any performance update using this :

<?php echo $this->renderPartial(’_form’, array(‘model’=>$model)); ?>

Can anybody confirm that, this uses ajax, because firebug also does not show anything …

No, renderPartial does not use AJAX. It’s pretty similar to what PHP include does.

To achieve what you want to, do this:

  1. Create a new action in the controller called actionUploadIndex and put the renderPartial code in there.

  2. On your main page load, trigger a JQuery AJAX function that fetches the data from controller/uploadIndex.

  3. Once you have the data, replace the div.


Thanks BCR, I called the following jquery function and this is my answer: