我想知道是否可以使用本地userInput变量来修改查询。即用户通过此输入表单提供的名称:
<input type="text" id="userInput"></input>
像这样:
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);
答案 0 :(得分:1)
是。抓取id输入的文本并访问如下值:
document.getElementById('userInput').value