$.getJSON content type?
$.getJSON content type?
Hi,
I a writing an application using jQuery talking to a spring MVC backend. I've set the controller up to return JSON by using the @ResponseBody annotation in my controller. This works by looking at the content-type to determine the output. It means I can just return a POJO and spring will automagically convert to JSON.
My problem is it doesn't work with $.getJson. This procedure looks like this in jQuery 1.4.4.
getJSON: function( url, data, callback ) {
return jQuery.get(url, data, callback, "json");
}
So the conent type is set to "json"? A bit of googling and it would seem that the standard is actually "application/json". I have manually changed my copy of jQuery to the latter and now $.getJson is working.
Is this a bug that needs fixing? I intend on sing jqGrid with these json requests and I don't know yet if this is going to be an issue.
Anyone else come across this issue?
Thanks
Ben