-2
I got the following object:
1,2,3,4,5,6
I would like to convert it to JSON to recover in php to perform a for loop:
{"id":"1"}
{"id":"2"}
{"id":"3"}
{"id":"4"}
{"id":"5"}
{"id":"6"}
I take this amount from bootstrap-multiselect.
Following 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>
the JSON you gave as an example is invalid, what kind of structure you need to receive on the server?
– Tobias Mesquita
A JSON object cannot have repeated keys, not to know if you want to create an array of ids, an array of objects.
– BrTkCa
altered. please check if it is correct
– adventistaam