Hi,
this is my ajax request that works perfectly on IE and FIREFOX, but
not in CHROME!
function sendMessage(baseUrl, idNickRcv, msg) {
var requestObject = new Object();
requestObject.idNickRcv = idNickRcv;
requestObject.msg = msg;
var jsonRequest = JSON.stringify(requestObject);
if ((idNickRcv) && (msg)) {
new Ajax.Request(baseUrl + '/usermsg/index/sendmessage', {
method: 'POST',
requestHeaders:{ Accept:'application/json' },
parameters: escape(jsonRequest),
onSuccess:
function(transport, json) {
//use and handle foo response data
}
,
on500:
function(transport) {
//handle error, inform user
},
onComplete: parseSendMessage
});
}
the problem is in action side server.
there is this PHP / ZEND FRAMEWORK code:
....
$request = urldecode($this->getRequest()-
>getRawBody());
$requestObject = $zendJson->decode($request,
Zend_Json::TYPE_OBJECT);
....
Json decoding fails with Syntax Error, for this reason Ajax request no
works and is interrupted.
Chrome send a bad json string!
Any suggests?
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.