0
I need to make this code work. But every time I put the variable in place or inside "" it doesn’t work.
//jvectormap data
var visitorsData = {
"US": 398, //USA
"SA": 400, //Saudi Arabia
"CA": 1000, //Canada
"DE": 500, //Germany
"FR": 760, //France
"CN": 300, //China
"AU": 700, //Australia
"BR": (TOTAL_VISIT_PAIS), //Brazil
"IN": 800, //India
"GB": 320, //Great Britain
"RU": 3000 //Russia
};`
I wanted it to look something like this:
//jvectormap data
var visitorsData = {
"US": 398, //USA
"SA": 400, //Saudi Arabia
"CA": 1000, //Canada
"DE": 500, //Germany
"FR": 760, //France
"CN": 300, //China
"AU": 700, //Australia
(CODE_PAIS): (TOTAL_VISIT_PAIS), //Brazil
"IN": 800, //India
"GB": 320, //Great Britain
"RU": 3000 //Russia
};`
Thanks for your help. :)
Have you tried
visitorsData[CODE_PAIS] = TOTAL_VISIT_PAIS;
?– Sergio
I read the your comment, then you want to add to the object
visitorsData
data that comes from PHP is this?– Sergio
Or you want to add data to that object in PHP directly?
– Sergio
And this JS code that you have in question is done in PHP? could you put a loop in PHP to create these properties. Ie reading from the BD do something like
js.= $chave.': '.$valor.',';
Is that what you want? in this case shows part of PHP to give you a more concrete example– Sergio