On Mon, Jun 10, 2013 at 3:11 PM, Andrea Del Bene <an.delb...@gmail.com>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().**write(calculateResponse(**action, > attributes)); > } > > private String calculateResponse(StringValue action, Attributes > attributes) { > String response = "{{" + > "\"Herausgeber\": \"Xema\", " + > "\"Nummer\": \"1234-5678-9012-3456\"}}"; > Why there are doubled '{' and '}' ? > > if(action.toString().equals(**SAVE)){ > IRequestParameters requestParameters = attributes.getRequest(). > **getRequestParameters(); > response = requestParameters.**getParameterValue("** > teamCalendarJson").toString(); > } > System.out.println(response); > return response; > } > > > As you said the error could be a missing settings for content-type > header. Should I use "application/json"? > Yes. > > 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, Jun 10, 2013 at 2:02 PM, Andrea Del Bene <an.delb...@gmail.com >> >wrote: >> >> 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. >>> >>> ------------------------------****----------------------------** >>> --**--------- >>> To unsubscribe, e-mail: >>> users-unsubscribe@wicket.**apa**che.org<http://apache.org> >>> <users-unsubscribe@**wicket.apache.org<users-unsubscr...@wicket.apache.org> >>> > >>> >>> For additional commands, e-mail: users-h...@wicket.apache.org >>> >>> >>> > > ------------------------------**------------------------------**--------- > To unsubscribe, e-mail: > users-unsubscribe@wicket.**apache.org<users-unsubscr...@wicket.apache.org> > For additional commands, e-mail: users-h...@wicket.apache.org > >