I am working in extjs+yii. My server side is in yii framework and client side is in extjs. Now I want to pass extjs's submit buttons output to yii action. I am creating multiple choice question paper of 20 questions in extjs whose actual questions will come from server side action which is written in Yii framewok. Up to this, it is working correctly.
Now after solving all questions by marking its respective radio buttons as an answer, on the click of submit button I want to send these 20 questions userId
, questionId
and selected radio buttons option to yii controller action. I had written submit button action as:
check:function()
{
console.log("Inside check function.");
//creating objects in javascript
var obj=new Object();
for(var i=0;i<=5;i++)
{
var inputs = document.getElementsByName(i);
var radio = "";
for (var j = 0; j < inputs.length; j++) {
if (inputs[j].checked) {
name = inputs[j].name;
value = inputs[j].value;
//obj[i].name1=name;
obj[i]={'questionId':name,'option':value};
console.log("questionId="+name +" value="+ value);
console.log("object name="+ obj[i].questionNo+" Object value="+obj[i].option);
}
}
}
}
});
So I am getting questionId
and optionValue
of all questions on submit button click. Now I want to send all the questionid
and optionValue
data to yii action. So how to send it to extjs action?
You should post your data to an action in a controller with AJAX for example : site/savequestions
and then in the controller
SiteController
you would have