Hi, I don't know that it's the problem because I'm not a PHP person, but you're using the `escape` function to encode your parameters, and then decoding them with a PHP function called `urldecode`. JavaScript's `escape` function does _not_ URL-encode things, it does something similar but different and is almost certainly not what you want. I'm surprised it's working with other browsers, frankly, but perhaps that's my lack of PHP knowledge.
The most reliable way to send parameters that I know is to send them URL-encoded, and to decode them as URL-encoded data. In Prototype, the easiest way to do that is to supply a plain object to the Ajax.Request method (which Prototype will correctly encode for you): var jsonRequest = ...; new Ajax.Request( // ... parameters: {json: jsonRequest} // ... }); ...and then retrieve the value just as you would any other value: $request = $_POST["json"]; $requestObject = Zend_Json::decode($request); // Or your $zendJson, whatever that is But again, I'm not a PHP guy and could easily be missing something important here. FWIW, -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Nov 8, 5:47 pm, fashionpeople <fashionpeople.busin...@gmail.com> wrote: > 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 prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.