How to call controller action from d3.js or any javascript in rails -
i trying understand how can call controller action when user presses circle in d3.js graph. idea controller action should show more information circle database i'm interested in how call rails controller action user's click. haven't put controller code in because i'm interested in how call made.
the relevant part of javascript looks like:
var node = svg.selectall(".node") .data(graph.nodes) .enter().append("circle") .attr("class", "node") .attr("r", function(d) { return d.group * 3; }) .style("fill", function(d) { return color(d.group); }) .call(force.drag) .on('click', connectednodes) .on("dblclick",getprofile(d)); function getprofile(d){ $.ajax({ url: "/users/show" , type: "get", data : { name: json.stringify(d.name) } });
define dblclick
this:
.on("dblclick", getprofile);
Comments
Post a Comment