how to pass these strings from php to javascript

后端 未结 5 1594
轮回少年
轮回少年 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:03

    Use the serialize() method. Pass the variables in a input field and:

    $.post("loaddata.php", $("#ajaxform").serialize(), function(data){
      //
    });
    

提交回复
热议问题