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
  • 17

1 Answers1

1

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

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

myAwesomeFunction(obj);
Alex Pliutau
  • 21,392
  • 27
  • 113
  • 143