小编jer*_*_se的帖子

使用OrientDB JavaScript API构建Web应用程序

我在弄清楚如何让OrientDB JavaScript API在Web应用程序中工作时遇到了一些困难.

我尝试搜索OrientDB Studio Web应用程序的源代码,并注意到他们使用了orientdb JavaScript API以及一些看起来非常迷人的AngularJS,但后来我尝试创建一个导入的简单网页orientdb-api.js和jquery库,它没有用.

这是我的网页内容:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script src="orientdb-api.js"></script>
    <title></title>

    <script>
        function connect() {
            var orientdb = new ODatabase("http://localhost:2480/GratefulDeadConcerts");
            var orientdbinfo = orientdb.open();
        }
    </script>
</head>
<body>
    <input type="button" value="Connect to OrientDB" onclick="connect()"/>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

我在我的JS中使用localhost,但在我看来,从客户端访问服务器上的orientdb数据库是没有意义的.我想我错过了一些东西,但我仍然非常喜欢使用针对OrientDB的JS API.我应该使用像Node.js这样的东西,还是独立的JS文件?

当我在随附的HTML文件中运行JS代码时,我收到此错误消息.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:2480/database/GratefulDeadConcerts. This can be fixed by moving the resource to the same domain or enabling CORS.
Run Code Online (Sandbox Code Playgroud)

任何帮助,建议或资源将不胜感激.

此致,Jeremie

javascript server-side-scripting orientdb

2
推荐指数
1
解决办法
1632
查看次数