how to pass these strings from php to javascript

后端 未结 5 1598
轮回少年
轮回少年 2020-12-20 07:25

i have 4 strings in my application like this that i want to pass to my js file

$a1=\'[10,20,13,14]\';
$a2=\'[17,15,14,16]\';
$a3=\'[18,24,16,17]\';
$a4=\'[15         


        
5条回答
  •  南方客
    南方客 (楼主)
    2020-12-20 08:07

    return "{ A1: '[10,20,13,14]', A2: '[17,15,14,16]', A3: '[18,24,16,17]', A4: '[15,54,18,27]' }";
    

    Though you could also just pass these as actual arrays by removing the quotes.

提交回复
热议问题