it was always a question for me that how can i use an array value in javascript while that array is defined in my php scripts
For example consider reading some values from a file and use it in javascript.
what’s ur plan to do so ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the
json_encodefunction, to safely return a JSON object which you can use directly in JavaScript:Outputs: