Json should be JSON. so you should use... new Request.JSON()
and JSON.encode() Fábio Miranda Costa Engenheiro de Computação http://meiocodigo.com On Sun, Feb 22, 2009 at 6:19 PM, h...@nnes <[email protected]>wrote: > > Hi there, > > Sorry the post went of before finished! So this is my actual post: > I'm trying to send some json object to php and to get the very same > object back. > I envisioned that to be the absolute minimum configuration, but I > still can't get it to > work. Please point me to WHERE, WHAT is doing WRONG? I was exeprcting > to > get prompted with "1", but instead it is causing an error by returning > NULL? > > Thanks a lot, Best, Hannes > > > THIS IS THE CALL FROM JS > > $('loadJson').addEvent('click', function(e) { > e.stop(); > var jsonRequest = new Request.Json({ > method: 'get', > url: 'http://www.whatever.com/JSONdeANDencode.php', > onComplete: function(realJson, stringJson){ > alert(realJson.a); > } > }).send("json="+Json.encode({'a': '1', 'b': '2'})); > }); > > > > THIS IS THE JSONdeANDencode.php > > $arr = json_decode($_GET['json']); > $json = json_encode($arr); > print $json; >
