i'm going through a json javascript object to create the options for a select. it works ok if i use 1 element, like so (this is in my 'success' from the ajax call.... getting the data from php)...
var my_json = JSON.parse(data);
for (var a=0; a < my_json.length; a++)
{
$('#my_list')
.append($('<option', { value: my_json[a].SOMEFIELD } )
.text(my_json[a].SOMEOTHERFIELD));
}
That works fine, but instead of setting the value to just 1 field, i want to set:
value: my_json[a]
and pass 6 or 7 fields as the option value... - problem is, in my onclick function for the select, i can get the val from the select and see it's an object, but trying to get any field out of it seems to be undefined....
passed_data = $('#my_list').val();
var passed_id = passed_data[0].ID;
and tried...
var passed_id - passed_data[ID];
etc... they're undefined....
i can see "passed_data" is an object, but can't seem to get any fields out of it...