I discovered to have some problem to fully understand callbacks scoping when trying to learn Jquery. I would add that i have little experience with the Javascript language The code:
var globDom; // placeholder for DOM fragment // Getting xml file; jquery parses the file and give me back a DOM fragment // saveXML is the callback $.get(requestTarget, {}, saveXML); // the globDom here is UNDEFINED ! alert(globDom); // the callback function saveXML(xmlDom) { globDom = xmlDom; }
I am sure that here there is a BIG misunderstanding by me …
Have any suggestion?
Thanks
Daniel
Ah-Ah. Very clear, I understand perfectly the error in my assumption: i forgot to take in account the time lag between the access time to the data (previous!) and the time at which content becomes available. A quite serious flaw – batch programming biased 🙁 The problem is clear and I can now address it properly. Many, many thanks for responding!
What Herms said. your (simplified) timeline looks like