Folks, Let's say that I am using the jquery.chosen plugin:
https://harvesthq.github.io/chosen/
Let's also say that I've been able to dynamically populate a multiple select with values using javascript:
<script type="text/javascript">
function appendToChosen(id,value){
$('#stuff')
.append($('<option></option>')
.val(id)
.attr('selected', 'selected')
.html(value)).trigger('chosen:updated');
}
</script>
Where "id" is for a group id, and value is for a unique email address.
BUT, I want to grab all of the selected option values that are populated in the multi-select in javascript, particularly for ajax stuff.
Using something like:
function rule_add(id)
{
$("#stuff").trigger("chosen:updated");
var url = "scripts/script.php"; // the script where you handle the form input.
$.ajax({
type: "POST",
url: url,
data: $("#idForm").serialize(),// serializes the form's elements.
success: function(data)
{
}
});
return false;
}
Where the multi-select data is in the form ends up getting posted as:
group_list[] 19
group_list[] 19
group_list[] 19
group_list[] 19
Where the "19" shown above comes from the "id" variable for the group id. I want it to post the values of each which would end up being each separate email address. Any ideas?
Thanks!