Uncaught SyntaxError: Unexpected token : valid JSON
This question already has an answer here:
To solve the error
No 'Access-Control-Allow-Origin' header is present on the requested resource.
you should add some codes in your server . Java version:
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// ...
response.addHeader("Access-Control-Allow-Origin", "*");
// you can change * for your spec url.
// if * is used, any url can be access to the data.
// ...
}
and you can use dataType: 'json'