I am submitting a form through ajax. Currently, I put together the post data like this:
for(i=0; i<document.formname.elements.length; i++){
if(document.formname.elements[i].type=='checkbox' && document.formname.elements[i].checked!=true){continue;}
if (i>0){data = data + "&";}
data = data + document.formname.elements[i].name + "=" + encodeURIComponent(document.formname.elements[i].value);
}
This worked until I changed one of my select boxes to select multiple. This code snippet only gets the one of the selected values.
imagine I have this in my form:
<select name="selectme[]" multiple>
<option value="">Select Something</option>
<option value="987987">Choice 1</option>
<option value="35987">Another Choice</option>
<option value="98987">Choice 3</option>
</select>
How would I detect and gather the additional selections?