不能在cakephp中使用数组数据json


Can´t use array data json in cakephp

我正在尝试在响应JS中读取JSON信息。我有数据,但我看不懂我看到在调试模式下我的数组

(拿督)——"{"mensaje":"丫votado埃斯特视频"、"邻近":"0"}"

,但alert(datos.mensaje)alert(datos.estado)为空…

在我看来使用echo json_encode($data);和dataType调用Ajax是json和类型是Post

JSON.stringify(datos),我得到:

"{'"mensaje'":'"Ya has votado este video'",'"estado'":'"0'"}"

我想使用datos.mensaje

这是一个有点猜测你想说什么,但据我所知,你试图编码一个给定的JSON字符串。尝试在视图中使用json_decode:

回声json_decode(元数据),

http://nl3.php.net/json_decode