Passing a PHP array to JavaScript

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
berkayxx95
Forum Newbie
Posts: 1
Joined: Fri Jan 26, 2018 5:23 pm

Passing a PHP array to JavaScript

Post 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?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Passing a PHP array to JavaScript

Post by Celauran »

Send it in as an AJAX request and then use json_decode
Zulfi
Forum Newbie
Posts: 2
Joined: Tue Apr 17, 2018 4:35 am

Re: Passing a PHP array to JavaScript

Post 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
Post Reply