我正在尝试在响应JS中读取JSON信息。我有数据,但我看不懂 我在调试模式中看到了我的数组
(datos) - “{”mensaje“:”Ya has votado este video“,”estado“:”0“}”
,但alert(datos.mensaje)
或alert(datos.estado)
为空...
在我看来,使用echo json_encode($data);
和调用Ajax中的dataType是json,Type是Post
JSON.stringify(datos)
,我得到了:
"{\"mensaje\":\"Ya has votado este video\",\"estado\":\"0\"}"
我想使用datos.mensaje
此致
答案 0 :(得分:0)
这是一个猜测你想说的,但到目前为止,我可以看到你正在尝试编码给定的JSON字符串。尝试在视图中使用json_decode:
echo json_decode($ data);