Re: [Cppcms-users] Json content type
Brought to you by:
artyom-beilis
|
From: Marcel H. <ke...@co...> - 2013-06-19 16:45:38
|
On 19.06.2013 18:22, Ronnie Chowdhury wrote: > How do I get cppcms to return json objects with the application/json content > type rather than text/html http://cppcms.com/cppcms_ref/latest/classcppcms_1_1http_1_1response.html#a8fb156db7d2b0350fb6fee9ce9d300be > Using the 'div' example, response is received fine and if I look at the net > traffic (eg using fiddler), I note it has the correct structure but wrong > content type. Hmm, afaik a json_rpc_server should always set the right content-type, but you could use the method above. > This means jquery's ajax methods reject it with 'Invalid Content type'. Do I > need to have a mime type configured somewhere? If you want to return a json value you could use cppcms::json::value for this http://cppcms.com/cppcms_ref/latest/namespacecppcms_1_1json.html > Thanks > > ROnnie > Regards |