有一个数组
`Array
(
[0] => Array
(
[operative] => 2
[start] => 01:00:00
[end] => 13:00:00
[color] => 543939
)
[1] => Array
(
[operative] => 3
[start] => 08:00:00
[end] => 09:00:00
[color] => 52e612
)
)
`
需要将其更改为 JSON,所以我使用 json_encode(),我得到一个字符串[{"operative":"2","start":" 01:00:00","end":" 13:00:00","color":"543939"},{"operative":"3","start":" 08:00:00","end":" 09:00:00","color":"52e612"}]
但是当我通过函数 $.parseJSON() 或 JSON.parse() 将 JSON 用于 JavaScript 时,两者都没有给我定义。
好的,我已经这样使用了
options1 = '[{"operative":"2","start":" 01:00:00","end":" 13:00:00","color":"543939"},{"operative":"3","start":" 08:00:00","end":" 09:00:00","color":"52e612"}]'
options1 = $.parseJSON(options1);
alert($.param(options1));
但是警报显示我 undefined=&undefined=