Is it possible to store javascript variables into arrays?
var ord1 = <?=$count1?>;
var ord2 = <?=$count2?>;
var ord3 = <?=$count3?>;
"data":[[1,ord1],[2,ord2],[3,ord3]]
What is the correct way of doing it? I can't seem to be able to store it in this way.
Try this.
var array1 = [var1, var2, var3, var4];
var array2 = new Array(var1, var2, var3, var4);
Or
var array3 = new Array;
array3.push(var1);
array3.push(var2);
array3.push(var3);
array3.push(var4);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.