gpt4 book ai didi

javascript - 为什么我与 neo4j 的连接不起作用(通过 Javascript)

转载 作者:行者123 更新时间:2023-12-02 16:44:07 28 4
gpt4 key购买 nike

我正在尝试通过 JavaScript 与本地 Neo4j 数据集进行交互。但我收到此错误:

Uncaught SyntaxError: Unexpected token : (13:20:43:754 | error, javascript) at http://localhost:7474/?callback=jQuery111107695061936974525_1417522841327&{%22statements%22:[{%22statement%22:%22MATCH%20(n)%20RETURN%20count(n)%22}]}&_=1417522841328:2 success (13:20:43:958) at public_html/index.html:34

即我想使用网络应用程序发送和接收查询。这是我现在的代码:

<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script language="javascript" type="text/javascript" src="js/jquery-1.11.1.js"></script>
<script type="text/javascript">

var body = JSON.stringify({
statements: [{
statement: 'MATCH (n) RETURN count(n)'
}]
});
$.ajax({
url: "http://localhost:7474",
type: "POST",
data: body,
dataType: "jsonp",
contentType: "application/jsonp"
})
.done(function(result){
console.log(result);

})
.fail(function(error){
console.log(error.statusText);
}); </script>

</head>

最佳答案

它不起作用,因为您发布到了错误的端点。记下您的网址

Here are the docs .

大概应该是这样的:

$.ajax({
url: "http://localhost:7474/db/data/transaction/commit",
type: "POST",
data: body,
dataType: "jsonp",
contentType: "application/jsonp"
})

关于javascript - 为什么我与 neo4j 的连接不起作用(通过 Javascript),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27249430/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com