我可以使用javascript变量来查询Neo4j吗?

时间:2014-12-02 17:05:52

标签: javascript html variables neo4j

我想知道是否可以使用本地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);

1 个答案:

答案 0 :(得分:1)

是。抓取id输入的文本并访问如下值:

document.getElementById('userInput').value