我正在尝试使用对eXist DB REST API(1)的ajax调用来检索XML响应.
谷歌浏览器为我提供了以下控制台错误:
XMLHttpRequest cannot load XMLHttpRequest cannot load http://localhost:8080/exist/rest/db/movies?_query=%2Fmovies. Origin null is not allowed by Access-Control-Allow-Origin Origin null is not allowed by Access-Control-Allow-Origin
Run Code Online (Sandbox Code Playgroud)
虽然Firefox中的Firebug提供以下控制台错误:
GET http://localhost:8080/exist/rest/db/movies?_query=%2Fmovies 200 OK X 35ms jquery.min.js(line 18)
Run Code Online (Sandbox Code Playgroud)
这是代码的ajax部分:
$.ajax({
type: 'GET',
dataType: 'xml',
url: 'http://localhost:8080/exist/rest/db/movies',
data: {
_query: _query_value,
_key: _key_value,
_indent: _indent_value,
_encoding: _encoding_value,
_howmany: _howmany_value,
_start: _start_value,
_wrap: _wrap_value,
_source: _source_value,
_cache: _cache_value
},
success: function(resp){
alert("Resp OK!");
console.log(resp);
},
error: function(hqXHR, textStatus, errorThrown){
var x=0;
alert("fail0 " + hqXHR …Run Code Online (Sandbox Code Playgroud)