yar1
yar1

Reputation: 1351

D3.js: is it possible to make a sync xhr request?

Is it possible to make synchronous ajax requests using d3.xhr (and/ or any of it's convenience methods) ? I am talking about something like jQuery's async: false option. 10x

Upvotes: 3

Views: 582

Answers (1)

uKolka
uKolka

Reputation: 38720

No but there is still hope. The "a" in "ajax" may stand for "asynchronous", but third argument of XMLHttpReques.open() is sometimes useful. You can't do synchronous requests with d3 because it has that option hardcoded to be true. So if you really need to, you can override that behavior (generally it's not cool to mess with library code though) or simply use a callback to kick off execution of whatever you need after data is loaded and processed.

Upvotes: 1

Related Questions