I’m trying to understand the following code block and am a bit stumped.. specifically I’m confused as to what the YAHOO.example.XHR_JSON = part is about. It looks like we’re creating an anonymous method that creates a named anonymous method?
YAHOO.util.Event.addListener(window, "load", function() {
YAHOO.example.XHR_JSON = function() { (blah blah blah) };
If I try changing the YAHOO.exmaple.XHR_JSON to something like FooBar and I get told that foobar is not defined.
Any help is as always greatly appreciated..
XHR_JSONis just a property of theYAHOO.exampleobject. You can assign anything to this property, including a function.If you tried the following:
.. then
YAHOO.example.XHR_JSONwill be set to'foobar'eventually, but only after theloadevent has fired. That is probably why you gotundefinedwhen you checked for the value.