d3.js - How come I can't get this PJAX example working? -


this page demonstrates how use pjax in d3 load external html files: https://gist.github.com/mbostock/1367999

i've made exact copy of this: https://dl.dropboxusercontent.com/u/1531353/misc/docudocker/trialpjax/trial.html

however, version not working. getting dom error when click on link (instead of having html loaded onto page). have tried use chrome console find out causing dom error no avail. there forgot copy over?

when load pjax("ul li a", "#main"); content variable set "#main"

so, in function:

function load(href) {     d3.html(href, function(fragment) {       var target = d3.select(content).node();       target.parentnode.replacechild(d3.select(fragment).select(content).node(), target);       pjax(links, content); // reapply     });   } 

in line:

target.parentnode.replacechild(d3.select(fragment).select(content).node(), target); 

it's looking contents of #main, within document fragment loaded.

however, in case, there no #main gets set null. when try call replacechild null, error you're experiencing.

to fix it, set other pages has done, #main in each.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -