How to use an array value from php to javascript?

后端 未结 5 1116
不知归路
不知归路 2020-12-30 14:10

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 va

5条回答
  •  暖寄归人
    2020-12-30 14:50

    You can use the json_encode function, to safely return a JSON object which you can use directly in JavaScript:

    
    
    
    

    Outputs:

    
    

提交回复
热议问题