d3.js - d3.html not working with d3.v4 -


in d3 version 3, had code, worked great:

d3.html("http://google.com",function(frag){     console.log(frag); }); 

that code doesn't work in version 4. looking @ api , change log, thought perhaps this:

d3.html("http://www.google.com").get(function(error,frag){ console.log(frag); }); 

but doesn't work either. have working example of d3.v4 d3.html?

thanks

it's not problem d3. it's because page you're requesting doesn't allow cors. whether it's google.com or server should include access-control-allow-origin header response if want via async call (xmlhttprequest, aka ajax) on page located @ different origin server.

as proof see codepen: http://codepen.io/lukaszwiktor/pen/oxqwrk?editors=0011

in case of missing cors headers chrome dev console shows following error:

enter image description here


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -