Now we speak. Even if the situation didn’t change that much, because clicking the first three nodes still only opens the first two, we see no more errors in the console but one, and all the AJAX requests are correctly sent and their results served back, using $.proxyGet() when needed.
That particular error is brand new.
Apparently it happens at the start of the callback that shows a subtree, and it looks like it’s due to the fact that it doesn’t get any content from the server (line 198). We know our new AJAX setup works and we also know that this subtree download works in the original site, so there must be some difference between the URL which we request here and the one which is requested there.
In fact, the reason why data is empty is because the URL we request contains an ajaxFunction parameter which is empty instead of being loadNode. Pretty understandable that it doesn’t work.
Looking above in the code, we see that the ajaxFunctionString should be properly set to loadNode (line 178) if terms.php was contained in url (line 177). And that should be the case, because we downloaded terms.php in the first place.
Looking even more above, we see that the url is set to window.location.pathname (line 171).
Uff. That is the problem !! The url of the current page IS NOT the URL of the original one. This error is tough.
We cannot change window.location without causing the browser to show the new location… they are one-to-one related.
Looking around, in this script and in the others, we see that lines 171, 177, 178 in the former constitute a pattern also found in the latter. This error is tough. (déjà vu?)
There is a possibility, a hack really, but it could work. url is always accessed by calling indexOf on it, never ever any other usage. What about monkey patching String.prototype.indexOf?
My seventh attempt (open in jsFiddle):
produced this result:
Hurrah!! We got it.
Lets get back to the original page and compare.
Hm, we forgot about the right panel…
Let’s click on aesthetic sensitivity in jsFiddle, I mean… instead of clicking on its toggling icon (plus / minus).
Fantastic. The right panel’s HTML is properly downloaded and displayed.