I have multiple array buttons, and i need to send the value as array instead of string. Is that possible ?
This is my array format:
['2022-02-02','2022-02-08']
This is my radio button:
{% for data in date %}
<input type="radio" name="date" value="{{data}}" required>
{% endfor %}
I get the response as
"['2022-02-02','2022-02-08']", but i need as
['2022-02-02','2022-02-08']
So how to make radio to button to send data as array
Try using JSON.parse(). Take your string, str in this case, and do
let arr = JSON.parse(str)
arr should be your array.