I Need Help To Use Correctly The Ajax Tools In Yii


In native PHP and with jQuery I can do the following problem, but in Yii with the Ajax tools, I can’t do.

The problem with me, I couldn’t use the Ajax in the right way in Yii. I need help, or someone, who can help me with codes or explain me how I should implement my problem in Yii.

I am sorry, I am not native English speaker person, so I don’t know what is the correct name of the beyond “web application”.

In Yii, I would like to do a "content carousel". An Ajax method, what will paging the views in one page (without posting) (As like a slide show)

There is a list of the questions in the database. For every question, the user have to give an answer. ( I will store the answers in the database).

I want to do this with Ajax (without POST)


[*]So I go to the page, and the webapp posts the first question to the View.

[*]So On the page (in the view file) the user can see the first question and the answer opportunities.

[*]The user selects the answer, and then the user clicks on the "Next" button. (Ajax Button)

[*]After the click, the webapp inserts the answer to the database, and give back the second question, without POST!

[*]And the next question is viewed on the page. (By Ajax) (and so on) The Ajax, just update/replace the content of div, and id of the question! (The answer options is always the same)


I want to render the questions with Ajax, as like image/gallery carousel.

I can’t implement in Yii (with renderPartial, ajaxSubmitButton, etc.) I need help. I do this in the wrong way.

I tried to do this. You can here some codes. But I don’t understand, why It is good that, my webapp can renders out the first and then the second question, but after that, it can’t renders out the third question.

There is a mistake when I want to passing the variable to the javascript, or I don’t know… I don’t have idea. I would like to implement this with the ajaxSubmitButton and with renderPartial.

You can download the full source code from here(If someone wanna see it) with sql file.

I would like to render out one by one on the page… with Ajax.

inside the form (cactiveform) enable the ajax validation and then instead of using submit burton use ajaxSubmitButton and pass the id to update the questions like.




( 'Next' ,


( array( "questions/answer" )),


'success' =>'function


$( "#question" ).html



and process the answer and send the next question

for more information refer this link