>From a Java horizon it would be: writer.print("{success : true, message : 'good'}"); or writer.print("{success : false, message : 'bad'}");
(writing to the response's PrintWriter) Hoping I am not misinterpreting your question right now. /L On Oct 29, 4:19 pm, <mich...@haston.name> wrote: > What would my json response look like (syntax-wise) in this case? > > On Thu, 29 Oct 2009 07:28:43 -0700 (PDT), Lapis <petter.env...@gmail.com> > wrote: > > > I think I'd do it more like this, if i just wanted JSON as the > > response: > > > On the server: set the response type to "application/json", something > > to the equivalent of => response.setContentType("application/json") > > Then print your json object to the response (java stylee again): > > writer.print(String.format("{value: %d, feelingOk: %s}", 42, > > Boolean.TRUE)) > > > In the callback, it is handled like this: > > > onComplete : function (transport) { > > // obtain the json you sent > > var jsonObj = transport.responseJSON; > > // use it > > alert('feelingOk:'+jsonObj['feelingOk']); > > alert('value:'+jsonObj['value']); > > } > > > /L --~--~---------~--~----~------------~-------~--~----~ 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-scriptaculous@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 -~----------~----~----~----~------~----~------~--~---