gpt4 book ai didi

javascript - 如何动态决定并告诉 d3.json() 函数何时采用哪个 json

转载 作者:行者123 更新时间:2023-11-28 08:40:20 26 4
gpt4 key购买 nike

我有一个 d3 api,其中我必须获取两个 json 文件,但我需要告诉函数何时获取哪个文件。这可能吗???

最佳答案

您只需切换 URL 即可调用:

var url = condition ? url1 : url2;
d3.json(url, function(error, data) {
});

关于javascript - 如何动态决定并告诉 d3.json() 函数何时采用哪个 json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20564231/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com