Hi,
In my application , i am having a code like
$(document).ready(function(){
$("#"+<?=$r['Attribute']['id'];?>).each(function() {
type= "<?=$r['Attribute']['type'];?>";
attribute_id= "<?=$r['Attribute']['id'];?>";
if(type=="dropdown")
{
var ht = $.ajax({
type: "GET",
url: "http://localhost/FormBuilder/index.php/forms/viewChoices/"+attribute_id,
async: false
}).responseText;
var myObject = eval('(' + ht + ')');
alert(myObject);
// var getchoice=myObject.choices[0]["choice"];
//alert(getchoice);
}
});
}):
In the above code for each attributeid , i am seeing whether the type of its is a Dropdown then i am retriving its choices from that Ajax get from the Table Choices in the choice, My myObject displays like
{"choices":[{"choice":"Male"},{"choice":"Female"}]}//for a attribute with the label gender
{"choices":[{"choice":"BE"},{"choice":"ME"},{"choice":"MBA"}]}//for a attribute with the label qualification
But that getChoice displays only male , and later be since i am using [0]
i want to keep these first alerted values that is male and female in an array And then in the same array later to save only be,me,mba .. Because i want to keep these array values to be displayed in the dropdown box for the respective labels ...How to do so.......Please sugggest me...