当我们刚搭好框架准备用ajax调用controller层返回json数据时出现如下错误:
The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers ()
2.浏览器控制台错误
No 'Access-Control-Allow-Origin' header is present on the requested resource.
原因在于你访问controller层,将返回给浏览器一些数据,而这些数据将以何种格式返回?你没有定义或者设置,该怎么办???
设置之后页面可以直接返回结果: