jquery - Creating a relationship through Ajax Request in Neo4j -


i trying create relationship between 2 nodes through ajax request. below code -

var restserverurl = "http://localhost:7474/db/data"; $.ajax({     async: false,     type: "post",     url: restserverurl + "/node/1/relationships",     datatype: "json",     to: "http://localhost:7474/db/data/node/2",     contenttype: "application/json",     success: function( data, xhr, textstatus ) {          console.log("success"+data);     },     error: function( xhr ) {         window.console && console.log( xhr );         console.log("error");     },     complete: function() {         console.log("complete function");        } }); 

am setting parameter wrong? it's not creating relationship in neo4j , going error block. in url , attributes 1 , 2 id properties of nodes.

source node information relationship -

<id>:584 name:trt id:1 index:1 weight:0 x:250.48512294215675 y:138.53438454446515 px:250.79081359249457 

target node information relationship-

<id>:583 name:t id:2 index:2 weight:0 x:335.564840711768 y:255.65841599561486 px:335.4984412139487 py:255.42282166757116 

please suggest solution/rectification.

in object passing $.ajax() should remove property/line:

to: "http://localhost:7474/db/data/node/2", 

and replace with:

data: {"to": "http://localhost:7474/db/data/node/2", "type": "rel_type_here"} 

also, sure specify correct authentication header if authentication enabled neo4j. status code of response?


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -