在数组php + javascript中解析问题数组

时间:2019-02-27 17:31:24

标签: javascript ajax

我想使用ajax发布方法更改highcharts值中的数据。我可以做到,但是当我想使用ajax设置明细数据时,返回数据有一些问题。

数据的ajax响应为;

$datas["dataDrill"] =
    [
        [
            "name"  => "instagram",
            "id"    => "instagram",
            "data"  =>
            [
                "cats1" => 4,
                "cats2" => 5,
                "cats3" => 6,
            ]
        ],
        [
            "name"  => "google",
            "id"    => "google",
            "data"  =>
            [
                "google1" => 4,
                "google2" => 5,
                "google3" => 6,
            ]
        ],
        [
            "name"  => "gelecekCom",
            "id"    => "gelecekCom",
            "data"  =>
            [
                "gelecek1" => 4,
                "gelecek2" => 5,
                "gelecek3" => 6,
            ]
        ],
    ];

我保留它

var return = JSON.parse(response);

但数据已更改

id: "instagram", name: "instagram", data: cats1: 4, cats2: 5, cats3: 6

但是我想要这个

id: "instagram", name: "instagram", data: "cats1": 4,"cats2": 5,"cats3": 6

我找不到任何解决方案,我的javascript不好,有没有人可以帮助我。谢谢。

0 个答案:

没有答案