d3.js - Problems with loading Javascript -
hi i've started javascript , wanted use d3 , met problem:
xmlhttprequest cannot load https://blahblah/api/votes. no 'access-control-allow-origin' header present on requested resource. origin 'http://localhost:8000' therefore not allowed access.
this problem shown in console.
attached code:
<!doctype html> <html> <head> <title>testbed!</title> <script src="http://d3js.org/d3.v3.min.js"></script> <script type="text/javascript"></script> </head> <body> <script> d3.select("body").append("p").text("hi, whats up"); console.log(d3); d3.json("https://blahblah/api/votes", function(data) { var canvas = d3.select("body").append("svg") .attr("width", 500) .attr("height", 500) canvas.selectall("rect") .data(data) //the data in bracket because our function uses varible data .enter() .append("rect") .attr("width", function(d) { return d; }) .attr("height", 50) .attr("y", function(d,i) { return i*10; }) .attr("fill", "blue"); canvas.selectall("text") .data(data) .enter() .append("text") .attr("fill", "white") .attr("y", function(d,i) { return i*50; }) .text(function (d) { return d.document_id + 25; }) }) </script> </body> </html>
can give me clues going on?
Comments
Post a Comment