Passing PHP JSON to [removed] echo json_encode vs echo json declaration

后端 未结 9 2272
猫巷女王i
猫巷女王i 2021-01-05 01:52

I\'m trying to create a common constants file to share between php and javascript, using JSON to store the constants. But I\'m wondering why pass the JSON from PHP to javasc

9条回答
  •  猫巷女王i
    2021-01-05 01:58

    Passing PHP JSON to Javascript and reading
    var stuff = ; var arr = new Array(); arr= JSON.parse(stuff); document.write((arr[0].cust_code );

提交回复
热议问题