我有像这样的ajax json POST方法
$.ajax({
type: 'POST',
url: "localhost:8080/webeditor/spring/json/",
data: JSON.stringify(contents),
dataType: "json"
});
Run Code Online (Sandbox Code Playgroud)
控制器处理发布请求
JSONPObject json;
BindingResult result = new BeanPropertyBindingResult( json , "MyPresentation" );
@RequestMapping(value="json/", method = RequestMethod.POST)
public void savePresentationInJSON(Presentations presentation,BindingResult result) {
//do some action
}
Run Code Online (Sandbox Code Playgroud)
但是我收到了这个错误
XMLHttpRequest无法加载localhost:8080/webeditor/spring/json /.仅支持HTTP的跨源请求.
我不确定如何纠正上述错误.