3

I need to pass an array as a function argument from php to js.I need a way to pass them to the function.Can anyone please help me with this. Thanks a lot..

ess
  • 663
  • 3
  • 9
  • 16

1 Answers1

1

Convert your PHP array to JS Object (in JSON).

var obj = <?= json_encode($phpArr); ?>;

myAwesomeFunction(obj);
Alex Pliutau
  • 20,640
  • 26
  • 107
  • 142