Page 1 of 1

Passing a PHP array to JavaScript

Posted: Fri Jan 26, 2018 5:30 pm
by berkayxx95
Hello, I am trying to pass a JavaScript array to PHP. Is there a basic way to do it without going into other languages?

Re: Passing a PHP array to JavaScript

Posted: Sat Jan 27, 2018 8:04 am
by Celauran
Send it in as an AJAX request and then use json_decode

Re: Passing a PHP array to JavaScript

Posted: Tue Apr 17, 2018 6:01 am
by Zulfi
o convert your PHP array into JSON, you can use the json_encode function, which will return the JSON representation of the value that you have passed it