I have the following object :
1,2,3,4,5,6
I would like to convert it to JSON to retrieve it in php to hold a for loop:
{"id":"1"}
{"id":"2"}
{"id":"3"}
{"id":"4"}
{"id":"5"}
{"id":"6"}
I get this value from bootstrap-multiselect .
Here's an example:
<select id="category" class="form-control" multiple="multiple">
<option value="1">Aventura</option>
<option value="2">Comedia</option>
<option value="3">Ficção</option>
<option value="4">Drama</option>
<option value="5">Novela</option>
<option value="6">Category</option>
</select>
Javascript:
<script>
$('#category').click(function() {
alert($('#category').val());
})
</script>
Example: link