i using bootstrap-multiselect , need submit form selected options.
however on form submit, url gets ....&sites=1&sites=2&sites=3
while need ...&sites=1,2,3
here code:
<select id="sites" name="sites" class="form-control" multiple="multiple"> <option value="1">site 1</option> <option value="2">site 2</option> <option value="3">site 3</option> </select>
js:
$('button[type=submit]').click(function () { var text = $('#sites').val() //i have list in `text` 1,2,3 need in url //do rest , continue submit
how can post these selected values in url (i.e url/sites=1,2,3
instead of url/sites=1&sites=2&sites=3
)
thanks help!
you may rename select sites[]
<select id="sites" name="sites[]" class="form-control" multiple="multiple"> <option value="1">site 1</option> <option value="2">site 2</option> <option value="3">site 3</option> </select>
this send server submit without js 1 variable sites array multi selected options.
Comments
Post a Comment