I have a select box on a page that does a post with jQuery using .ajax and it works great when the select box can only select one value, but when I change it to “multiple” it appends [] to the end of the field name. For example listID without multiple is fine, but with “multiple” as an attribute changes the name to listID[]. Any idea what’s happening?
<select multiple size="5" name="frmRecipientList" id="listID">
$.ajax({
url: '/app/components/MailingsReport.cfc',
//POST method is used
type: "POST",
complete: function(){
$("#loader").hide();
},
//pass the data
data: {
method: "createEmailing",
title: $('#title').val(),
campaignID: $('#campaignID').val(),
brandID: $('#brandID').val(),
listID: $('#listID').val(),
maxRecipients: $('#maxRecipients').val(),
subject: $('#subject').val(),
fromName: $('#viewFrom').val(),
testToEmail: $('#testToEmail').val(),
htmlCode: $('#htmlCode').val()
},
dataType: "html",
listIDis<select multiple>. That means there can be multiple values. The[]makes it an array, so on the server, it can read all the values.