Why does this each statement cause my code to break? Also do I have to set an index with javascript?
var email = [];
email['update'] = true;
email['e_case_id'] = $("#e_case").val();
var i = 0;
$.each($('.rowChecked'), function() {
email['e_attachments'][i] = $(this).attr('id');
i++;
});
email['update'] = true;As discussed in some answers below you can use a literal object like an associative array:myLiteralObject = {}; myLiterObject["associativeStyleKey"] = "whatever";Arrayis also an object.eachmethod will only loop through the array items, not the object properties.