Reputation: 51
I have an array in a PostGreSQL query and I can't turn it into a session variable.
The table resulting from the query sends this: {1,2,3}
if I transform this into a session variable I have the same thing.
If in my query, I transform my array into a string, my session variable is: ['1','2','3']
When I use this session variable in javascript code and want to generate strings from it, it returns this: (sess_modules is my session variable)
for (i=0; i<sess_modules.length; i++) {
var module = `<div class="leaflet-sidebar-pane" id="module_${i+1}"></div>`
liste_modules.push(module);
$("#mydiv").html("${liste_modules}")
}
That's works but I have commas (cf picture). Why ?
I would like to know why my code returns commas too.
HTML code:
Upvotes: 0
Views: 88