JSON PHP Array to Javascript

后端 未结 5 1713
刺人心
刺人心 2020-12-17 04:53

Is it possible to JSON this php array via json_encode? Because this php array is called $data and when i do..

var myJson = 

        
5条回答
  •  孤街浪徒
    2020-12-17 05:27

    I've never tried to do something like this but I think that you're having issue because json_encode returns a json encoded string. You then need to decode this string on the javascript side of things. Try something like the following:

    var myJson = JSON.parse();
    console.log(myJson);
    

提交回复
热议问题