Background: I'm attempting to use d3 to create a choropleth as demonstrated here: http://bl.ocks.org/mbostock/4060606
My data is coming from a json-rpc api.
var rpcUrl = "http://localhost:3001/rpc/json";
var rpcData = '{"params": {}, "jsonrpc": "2.0", "method": "foo.method", "id": "bar"}';
console.log(d3.xhr(rpcUrl).post(rpcData, function(error, data){
console.log(error);
console.log(data);
}));
I'm getting the responseText:
responseText: "{"jsonrpc":"2.0","error":{"code":"bad_request","message":"JSON RPC requires a 'method' field"}}"
My method is obviously there in rpcData, so it appears I'm not actually providing the object at all. I suspect my trouble is misunderstanding of how d3.xhr is called. Any clues?
Note: if you are looking at the background info, you'll note that d3.xhr(url).post() is intended to be called using queue.js. I'm providing the simplified call above to avoid any confusion as to the source of the problem.