Invalid JSON Response. DataTables debugger: uxaqed
Invalid JSON Response. DataTables debugger: uxaqed
Yeah I know,
There is full topics in the forum covering this probleme but I swear that in my case, it does not work.
java spring backend that has a rest Controller (localhost:8080). This controller is in the form:
@RequestMapping(value = "/find-all", method = RequestMethod.GET, produces = "application/json")
public Map<String, Object> findAllMembers(
@RequestParam(value = "location", defaultValue = "Business Units") String location) {
return ControllerUtils.getDataMapFromList(membersService.findAllMembers(location) );
}
As you can see the code is simple and returns:
{
"recordsFiltered": 2,
"data": [
{
"fullName": "aiesmail",
"location": "Business Units",
"orgUnit": "org1",
"businessName": "business1",
"bossMail": "gid.morson@asdf.com",
"securid": "secur"
},
{
"fullName": "bernard.sirois",
"location": "Business Units",
"orgUnit": "org2",
"businessName": "business2",
"bossMail": "chantal.ferland@bell.ca",
"securid": "secur"
}
],
"draw": 1,
"recordsTotal": 2
}
And JSONLint confirms that the json is good. But datatables keeps telling me that I have an invalid Json response. Here's the response header coming from FireBug.
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Type: application/json;charset=UTF-8
Date: Thu, 04 Jun 2015 23:37:46 GMT
Expires: 0
Pragma: no-cache
Server: Apache-Coyote/1.1
Transfer-Encoding: chunked
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
x-content-type-options: nosniff
I hope that you can help me because I don't know what to do anymore...
Answers
Never mind. I let down jsonp and put an access-control-allow-origin * instead and it works.
Thanks
Good to hear you got it working. It wasn't working in the debug trace given as the response from the server was empty (and thus invalid JSON). Presumably this was due to the cross origin protection of the browser which you have now addressed.
Regards,
Allan