[英]Can I use a javascript variable to query Neo4j?
I am wondering if it is possible to use a local userInput variable, to modify queries. 我想知道是否可以使用本地userInput变量来修改查询。 Ie the name that the user gives through this input form: 即用户通过此输入表单提供的名称:
<input type="text" id="userInput"></input>
Like this: 像这样:
var body = JSON.stringify({
statements: [{
statement:'MATCH (tom {name: "userInput"}) RETURN tom' //'MATCH (n) RETURN n'
}]
});
$.ajax({
url: "http://localhost:7474/db/data/transaction/commit",
type: "POST",
data: body,
dataType: "json",
contentType: "application/json"
})
.done(function(result){
console.log(result.results);
Yes. 是。 Grab the text input by id and access the value like this: 通过id抓取输入的文本并按如下方式访问值:
document.getElementById('userInput').value
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.