javascript - d3.request.get 中 'data' 参数的数据类型是什么?

标签 javascript d3.js xmlhttprequest

作为对象:

d3.request('get_movies').get({"actors":"Shah Rukh Khan"},function(){
     console.log(arguments);
});

作为对象的 JSON 表示:

d3.request('get_movies').get(JSON.stringify({"actors":"Shah Rukh Khan"}),function(){
     console.log(arguments);
});

我可以找到关于应该作为数据参数传递什么的文档 https://github.com/d3/d3-request/blob/master/README.md

我尝试了一些,但在检查时似乎没有一个发送查询字符串参数。它也不构造相应的 URL

编辑:

我还尝试传递一个简单的字符串 URL 编码

d3.request('get_movies').get("actors=Shah%20Rukh%20Khan",function(){
     console.log(arguments);
});

最佳答案

应将查询参数添加到 url 中:

d3.request('get_movies?actors=Shah%20Rukh%20Khan').get(function(){
     console.log(arguments);
});

关于javascript - d3.request.get 中 'data' 参数的数据类型是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38974230/

相关文章:

javascript - 如何在 react-vis 中反转/下降/排序 x 轴数据

javascript - 在缩放/拖动时缩放/重绘 d3.js 网格线

node.js - 将带有正文的 POST XMLHttpRequest 发送到快速 Node 服务器

javascript - 尝试在 javascript 中舍入对象值

javascript - 使用 jQuery 设置动态下拉列表 (DOM) 的选定索引

javascript - 在 D3.js 中更新和转换组内的各个 SVG 元素

javascript - 我如何知道 XHR 请求出了什么问题?

xmlhttprequest - WinJS.xhr : Network Error 0x2efd,由于错误00002efd而无法完成操作

javascript - 如何使用 JavaScript 输出数组中出现的次数

javascript - 检查是否使用 jQuery 应用了 css