Re: Resource that produces JSON and JQuery

2013-06-10 Thread Andrea Del Bene
On 06/10/2013 02:17 PM, Martin Grigorov wrote: On Mon, Jun 10, 2013 at 3:11 PM, Andrea Del Bene wrote: The code is quite simple as it's basically a prototype. Java code: @Override public void respond(Attributes attributes) { StringValue action = attributes.getParameters().**get(S

Re: Resource that produces JSON and JQuery

2013-06-10 Thread Martin Grigorov
On Mon, Jun 10, 2013 at 3:11 PM, Andrea Del Bene wrote: > The code is quite simple as it's basically a prototype. Java code: > > @Override > public void respond(Attributes attributes) { > StringValue action = attributes.getParameters().**get(SEGMENT); > attributes.getResponse()

Re: Resource that produces JSON and JQuery

2013-06-10 Thread Andrea Del Bene
The code is quite simple as it's basically a prototype. Java code: @Override public void respond(Attributes attributes) { StringValue action = attributes.getParameters().get(SEGMENT); attributes.getResponse().write(calculateResponse(action, attributes)); } private S

Re: Resource that produces JSON and JQuery

2013-06-10 Thread Martin Grigorov
Hi Andrea, I guess your problem is related to jQuery's validation of the response. To parse the text response to JSON jQuery needs 1) correct response content-type header 2) valid JSON - make sure the keys are in double quotes Show us your code and the produced response for more help. On Mon, J

Resource that produces JSON and JQuery

2013-06-10 Thread Andrea Del Bene
Hi, can anybody point me to some code that illustrates how to produce a JSON valid text with a mounted resource? My goal is to load it via AJAX in a page with JQuery function getJSON. I've tried to directly write JSON into the response object without any success.