林Doiung錯了嗎?PHP Zend框架的JSON解碼用ajax失敗
感謝所有幫助
編輯:
香港專業教育學院嘗試過:
$.ajax({
url: STValentines.baseUrl+'/mensaje/sendmessage',
type: 'POST',
dataType: 'json',
data: {userId: '111', imageUrl: 'imageurl', message: 'message' },
success: callBack
});
同樣的錯誤
編輯2:
這裏再次js代碼PHP代碼和結果:(
$.ajax({
url: 'testURL',
type: 'POST',
dataType: 'json',
data: "{'userId': 'test1234', 'imageUrl': 'testimageUrl', 'message': 'testmessage' }",
success: callBack
});
public function sendmessageAction() {
$data = $this->_request->getPost();
print_r($data);
$response = $data;
$this->_helper->json($response);
結果:
Array
(
)
是您的正確格式的JSON字符串? – 2012-02-01 21:31:11
'$ data'實際上是否包含JSON字符串? PHP的本地'json_decode()'工作嗎? JSON字符串中是否有多字節/非ASCII字符? – Carpetsmoker 2012-02-01 21:31:41
請看我的編輯 – gruber 2012-02-01 22:00:14